Retrieving autonumber

Retrieving autonumber

am 29.08.2007 03:08:54 von Paulo Roberto

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!

Re: Retrieving autonumber

am 29.08.2007 12:53:43 von reb01501

Paulo Roberto wrote:
> Hi, how can I retrieve a ID from a AutoNumber field on MS Access
> after an insert into instruction?
>
http://databases.aspfaq.com/general/how-do-i-get-the-identit y/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"

Re: Retrieving autonumber

am 29.08.2007 17:27:26 von Jon Paal

The access example provided from link fails. 2 part SQL doesn't work ??

<%
fakeValue = 5
set conn = CreateObject("ADODB.Connection")
conn.open ""
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
%>


"Bob Barrows [MVP]" wrote in message news:uqMdYri6HHA.5212@TK2MSFTNGP04.phx.gbl...
> Paulo Roberto wrote:
>> Hi, how can I retrieve a ID from a AutoNumber field on MS Access
>> after an insert into instruction?
>>
> http://databases.aspfaq.com/general/how-do-i-get-the-identit y/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"
>

Re: Retrieving autonumber

am 29.08.2007 17:41:20 von reb01501

Jon Paal [MSMD] wrote:
> The access example provided from link fails. 2 part SQL doesn't work
> ??
>
> <%
> fakeValue = 5
> set conn = CreateObject("ADODB.Connection")
> conn.open ""
> sql = "INSERT someTable(IntColumn) values(" & fakeValue & ")" & _
> VBCrLf & " SELECT @@IDENTITY"

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.

Re: Retrieving autonumber

am 06.09.2007 13:48:20 von mmcginty

"Bob Barrows [MVP]" wrote in message
news:O6R1MMl6HHA.1148@TK2MSFTNGP05.phx.gbl...
> Jon Paal [MSMD] wrote:
>> The access example provided from link fails. 2 part SQL doesn't work
>> ??
>>
>> <%
>> fakeValue = 5
>> set conn = CreateObject("ADODB.Connection")
>> conn.open ""
>> sql = "INSERT someTable(IntColumn) values(" & fakeValue & ")" & _
>> VBCrLf & " SELECT @@IDENTITY"
>
> 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 ... ?

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



> --
> 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.
>
>

Re: Retrieving autonumber

am 07.09.2007 16:25:39 von Jon Paal

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.


>
> 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?
>