2 messages in com.mysql.lists.win32Re: LAST_INSERT_ID() in ASP pages.
FromSent OnAttachments
Glenn F. Henriksen01 Dec 2000 16:44 
Carsten Gehling01 Dec 2000 16:46 
Subject:Re: LAST_INSERT_ID() in ASP pages.
From:Carsten Gehling (cars@gehling.dk)
Date:12/01/2000 04:46:21 PM
List:com.mysql.lists.win32

From: "Glenn F. Henriksen" <gle@itl.no> Sent: Saturday, December 02, 2000 1:44 AM

RecordSet = oConnection.Execute("select LAST_INSERT_ID()")

Now I have an empty recordset... What am I doing wrong? I get an error message from the SQL server if I have them both in the same statment seperated with ;

I don't know why it is so, but I've had the same problem. My workaround (which works!) is as follows:

(I assume, that you table is called "YourTable", and the auto_increment field is called "id")

set RecordSet = oConnection.Execute("select id from YourTable where id = LAST_INSERT_ID()")

Now you have the value in RecordSet("id")

- Carsten