find record ID

Results 1 to 2 of 2

Thread: find record ID

  1. #1
    Join Date
    Dec 1969

    Default find record ID

    I sucessfully added a new record to my table. NOw I would like to get the Primary ID of the record i just added in the same process page with out doing another sql statement. Anyone know any tricks to do that?<BR><BR>

  2. #2
    LeeAnnie Guest

    Default Yes, use adOpenKeySet

    Here is an example.... HTH<BR><BR>set RS = Server.CreateObject("ADODB.Recordset") <BR>RS.Open "my_table", strConnect, adOpenKeySet, adLockPessimistic, adCmdTable<BR>RS.AddNew <BR>RS.Fields("field1") = strFirst<BR>RS.Fields("field2") = intSecond<BR>uniqueID = RS.Fields("id")<BR>RS.Update <BR>RS.Close<BR>set RS = nothing

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts