TheCandyman
Technical User
After i do an insert to my MS Access DB, i am trying to find a way to get the UserID (autonumber) it just created. I have look high and low and see a few ways, but nothing seems to work. There are quite a few that suggest using the @@Identity, but i can't seems to get that working either. (The insert works great)
Error
Code
Error
Code:
Microsoft OLE DB Provider for ODBC Drivers error '80040e51'
Provider cannot derive parameter information and SetParameterInfo has not been called.
/convention/reg/stage2.asp, line 61
Code
Code:
Set addNew = Server.CreateObject("ADODB.Command")
addNew.ActiveConnection = MM_data_STRING
addNew.CommandText = "INSERT INTO tbl_Mailing (Address,City,State,Zip,Phone,Fax,EMail) "&_
"VALUES('"&Request("Address")&"','"&Request("City")&"','"&Request("State")
&"','"&Request("Zip")&"','"&Request("Phone")&"','"&Request("Fax")&"',
'"&Request("EMail")&"');"
addNew.Execute()
addNew.CommandText="SELECT @@Identity as GPID;"
addNew.Execute()
GPID=addNew("GPID")
response.write "DONE " & GPID