PDA

Click to See Complete Forum and Search --> : SQL-ASP session question.


ptran
Oct 13th, 2000, 07:31 AM
I have the following code, within the same ASP session, I can't seem to get the InvID after I add it into the SQLServer. Is there Anyway I can get the value of InvID without futher coding?

Thanks

Set rsContact = CreateObject("ADODB.Recordset")
Set rsContact.ActiveConnection = objConn
rsContact.Locktype = 2
rsContact.AddNew
rsContact.Update

InvID = rsContact("InvID")

Ianpbaker
Oct 13th, 2000, 07:42 AM
According to that code, you connect to the database add a new blank record and try to retrieve a value from that existing record. Are you using default's for the fields ot am I completly missing the plot.

Ian

ptran
Oct 13th, 2000, 07:57 AM
Lanpbaker,

All the fields are default, except for InvID, which default to automumber in SQL DB when add new record. What I'm trying to do is to retrieve this InvID after the record is add with-in the same session to enter all the fields. I have no problem with MS-Access DB, but can't get this to wokr on SQL DB.

Thanks