HOWTO: FormView Insert Operation - Get Row ID of Inserted Row

D

Dan Sikorsky

Using: MS SQL Server 2005 Sept 05 CTP, MS Visual Studio 2005 Beta 2

How can I get the SQL Server Row ID of the newly inserted row when adding a
new record to the database using a FormView Control on a web page?

I've looked at the FormView_ItemInserted FormViewInsertedEventArgs but to no
avail.

I need to immediately update a secondary table using this ID gotten from the
newly created row.
 
G

Guest

AFAIK, you will have to return the @@IDENTITY (or, better yet,
SCOPE_IDENTITY()) in your T-SQL code. I have not delved into this particular
issue, but I do not think there is an automagic way of getting an IDENTITY
value, even with SQL 2k5.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top