Can any help with this little problem I'm generally used to working with ASP/SQLServer but need to use MYSQL this time.
When I insert a new record I use the following method to retrieve the auto increment ID of that row.
strSQL = Mytable
strDB = My Database connection string
Set rsData = Server.CreateObject("ADODB.Recordset")
RSData.CursorLocation = 3 ' adUseClient
RSData.Open strTable, strDB, adOpenKeySet, adLockOptimistic, adCmdTable
RSData.addNew
RSData("Company_Name") = "My new company"
RSData.Update
strNewCompany_ID = RSData("Company_ID")
strNewCompany_Name = RSData("Company_Name")
RSData.Close
Set RSData = Nothing
This method works fine with SQLServer but with MySQL it just retrieves the ID and Company name of the first row in the database.
The new record is inserted fine - the db might be used by a high number of users so I don't just get the MAX ID number after a new insert.
Thanks