Groups | Blog | Home
all groups > inetserver asp components > october 2003 >

inetserver asp components : Recordset doesn't return @@identity field


A_X_L_V
10/20/2003 3:44:20 PM
May not be the right group to post, but...

Here's a situation. ASP code creates Connection and Recordset objects, and
uses .AddNew function to add a record to the table. No matter what Recordset
parameters I specify, I cannot get @@identity field back.

Micr$oft claims it works in this article
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndao/html/daotoadoupdate_topic5.asp
and it may work for Client-Server, but I am struggling to make it work in
ASP (IIS 5, Win2K Server).

I have to user AddNew method, because I am inserting data into a Text(16)
field. Can't really use stored proc to do that because inserted text is
larger than 8000 chars. MSDN recommends to use "SET NOCOUNT ON;INSERT
....;SELECT @@IDENTITY as ID;SET NOCOUNT OFF;" query for insertion, but I
can't use that again for the reason above - I am using
adoRS.Fields("mytext").AppendChunk to insert data.

Please help or direct me to the right newsgroup.

Thanks

Aaron Bertrand - MVP
10/20/2003 3:54:55 PM
[quoted text, click to view]

Don't do this! Use an INSERT statement.

[quoted text, click to view]

http://www.aspfaq.com/2174

Ray at <%=sLocation%
10/20/2003 4:01:48 PM
www.aspfaq.com/5003

Ray at work

[quoted text, click to view]

AddThis Social Bookmark Button