dseaver
IS-IT--Management
- Jul 13, 2006
- 467
I posted this in the SQL forum, and I got directed here, here is the problem:
I am new to writing SQL code, but I am following a Tutorial from asp.net. I have written the following insert for my SQL DB, and I want it to return a scalar of the created records Primary key.
I am trying to write an API in C#, which would return the Index, but I can't get this to work in the DAL level.
Here is the link to the Tutorial that is implementing a similar insert into there DAL. It's under "STEP 4: Inserting Updating and Deleting Data" under "Creating Custom Insert, Update, and Delete Methods". Its about 3/4 down the page:
I am new to writing SQL code, but I am following a Tutorial from asp.net. I have written the following insert for my SQL DB, and I want it to return a scalar of the created records Primary key.
Code:
--example
INSERT INTO MyTable
(OtherTableReference, Descrip)
VALUES (@OtherTableReference,@Descrip)
SELECT SCOPE_IDENTITY() --Error here: Unable to parse query text.
I am trying to write an API in C#, which would return the Index, but I can't get this to work in the DAL level.
Here is the link to the Tutorial that is implementing a similar insert into there DAL. It's under "STEP 4: Inserting Updating and Deleting Data" under "Creating Custom Insert, Update, and Delete Methods". Its about 3/4 down the page: