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!
***************************
 
Joined
Apr 30, 2009
Messages
1
Reaction score
0
It seems this would be an appropriate case for triggers, yes?

Apologies for necromancing a 4-year old thread, but this post comes up when I searched for "SQL id of inserted row", so it seemed appropriate that I mention it.
 

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

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top