View Full Version : VB and SQL help needed


gmit
02-04-2008, 11:28 AM
Hi
Does anybody know of a function or sample code that will tell me the last auto increment id from an insert query. I know of a function 'mysql_insert_id' in php but is there something similar in VB?

gmit
02-11-2008, 12:24 PM
I used the max(id) to achieve what I wanted:

strSQL = "Select Max(id) as lastID FROM " & strTable

DCrake
02-22-2008, 07:29 AM
I use this to get the Autonumber form a table that resides in SQL

Set Tbl = MasterDbConn.Execute("Select @@identity As XPropertyID")
LngLoginKey = Tbl.Fields("XPropertyID").Value