Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting uniqueidentifier from newly created DB rec

Status
Not open for further replies.

cyprus106

Programmer
Apr 30, 2001
654
I've got the following function, (The intTotal is for future creation,) in which I create a database record. I've got to get the uniqueidentifier (or autonumber, same thing almost but not really) for the record I just created. I've got nothing unique that I can search for to get the record. Deductively, the only way I can get this record is the uniqueidentifier. But I can't. I'm still know knowledgable enough to figure it out. I really hope someone else is. Thanks!!


function WriteSerial(intTotal)

Dim objConn
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open strConnect


set rsMList = Server.CreateObject("ADODB.Recordset")
rsMList.Open "Orders", objConn, adOpenForwardOnly, adLockOptimistic, adCmdTable

rsMList.AddNew

rsMList("OrderDate") = NOW
rsMList("Total") = intTotal

rsMList.Update

CartSerial = rsMList("Serial")

rsMList.close
Set rsMList = Nothing

WriteSerial = CartSerial

end function

Cyprus
 
If you have a field that is intended for writing some sort of uniqueidentifier in it, you could try creating your own unique identifier, the date and a random number, or simply a 4,5,6 digit number whatever. I didn't understood your doubt quite well. If this isn't what you really wanted, feel free to give some more information... and my english is not so great... [smile]
 
4GuysFromRolla.com : ASP FAQS : Databases, General
How do I get the record number of a just added record, using an Access database table? by Bill Wilkinson - 11/3/2000


Best regards,
J. Paul Schmidt - Freelance ASP Web Developer
- Creating "dynamic" Web pages that read and write from databases...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top