473,320 Members | 2,164 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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

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.

--
Dan Sikorsky, MSCS BSCE BAB

Nov 19 '05 #1
1 4389
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!
***************************
"Dan Sikorsky" wrote:
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.

--
Dan Sikorsky, MSCS BSCE BAB

Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

24
by: CJM | last post by:
I have the following SP: CREATE PROCEDURE Orders_CreateOrder @CustomerID int, @LocationID int, @CustOrderNo varchar(20), @OrderDate smalldatetime AS Insert into Orders (CustomerID,...
0
by: Guenter | last post by:
Hi, I am trying to use the ASP.NET 2.0 FormView as a method to enter data into my business object. At the moment, I am trying to do this without a custom DataSourceView control, but I can't...
1
by: Chris | last post by:
I have a formview based on an SQL Data Source see below. I have a formview bound to it. The item insert template has a command button with a command name insert. When I press it the insert doesn't...
0
by: =?Utf-8?B?UGF1bCBCdXp6YSwgb2xkc3RlciB1c2luZyBuZXcg | last post by:
I'm trying to retrieve the @@identity value of the just-inserted record using a FormView control on an .aspx page. Here's what I have tried..... --change in-line Insert in the SqlDataSource from...
6
by: AG | last post by:
ASP.NET 2.0 aspx page with a FormView bound to an ObjectDataSource to view, add and edit records. Can anyone point me to a sample of how to retain the user entered control values when an insert...
0
by: Dave | last post by:
How can I set the Value of a Textbox that resides in a FormView Insert Template? Thanks
0
by: =?Utf-8?B?X3ByZWZpeA==?= | last post by:
Hello All, I have written a page with a sqlserverdatasource control and a formview web control. I want to use stored procedures to perform CRUD operations. Formview textboxes bind to table...
3
by: Dilruba | last post by:
asp, vbscript, Ms Access I am using vbscript to insert & update ms accees. Insert operation is working , but update operation is not working. I have used the following codes: ...
1
by: d-42 | last post by:
Hi, I'm trying to use FormView to Insert an Object to an ObjectDataSource. The insert method signature is simply: void DALObject.InsertPerson(Person myObject) The person object for the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.