Groups | Blog | Home
all groups > inetserver asp db > august 2007 >

inetserver asp db : Retrieving autonumber


Paulo Roberto
8/28/2007 10:08:54 PM
Hi, how can I retrieve a ID from a AutoNumber field on MS Access after an
insert into instruction?

Is it possible to be done?

Thanks!

Bob Barrows [MVP]
8/29/2007 12:00:00 AM
[quoted text, click to view]
http://databases.aspfaq.com/general/how-do-i-get-the-identity/autonumber-value-for-the-row-i-inserted.html
http://support.microsoft.com/default.aspx/kb/221931
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

Jon Paal [MSMD]
8/29/2007 8:27:26 AM
The access example provided from link fails. 2 part SQL doesn't work ??

<%
fakeValue = 5
set conn = CreateObject("ADODB.Connection")
conn.open "<conn string>"
sql = "INSERT someTable(IntColumn) values(" & fakeValue & ")" & _
VBCrLf & " SELECT @@IDENTITY"
set rs = conn.execute(sql)
response.write "New ID was " & rs(0)
rs.close: set rs = nothing
conn.close: set conn = nothing
%>


[quoted text, click to view]

Bob Barrows [MVP]
8/29/2007 11:41:20 AM
[quoted text, click to view]

Oh! he never corrected that!! I brought it up with him two years ago! Of
course, he (Aaron) doesn't own the site anymore. Perhaps you could
report this to the current site owners ... ?
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.

Mark J. McGinty
9/6/2007 4:48:20 AM

[quoted text, click to view]

I don't think the site is being maintained anymore. One of the articles on
it includes a script to generate test data, that reportedly takes 7 minutes
to run. I submitted a revision that generates 28% more test rows, with
identical distribution, in under 15 seconds.

Usually, improving the performance of some op by almost a factor of 30 is
pretty attractive, from a programmer's perspective. :-) I guess I must
assume that the new owners of the site are not actually programmers?


-Mark



[quoted text, click to view]

Jon Paal [MSMD]
9/7/2007 7:25:39 AM
if they had allowed addition of user comments, or put the database into a wiki style format, it would continue to improve. As it is
now, the locked structure is too much to maintain.


[quoted text, click to view]

AddThis Social Bookmark Button