What does @@ identity pick?
I am connecting to mysql database via excel using odbc
what does this line do?
Set rs = oConn.Execute("SELECT @@identity", , adCmdText)
I am having trouble updating the database:
With rs
.AddNew ' create a new record
' add values to each field in the record
.Fields("datapath") = dpath
.Fields("analysistime") = atime
.Fields("reporttime") = rtime
.Fields("lastcalib") = lcalib
.Fields("analystname") = aname
.Fields("reportname") = rname
.Fields("batchstate") = "bstate"
.Fields("instrument") = "NA"
.Update ' stores the new record
End With
it ONLY updates .Fields ("instrument") = "NA", but for all other fields it puts NULL values
+2
a source to share
3 answers
It selects (and returns) the last value inserted into the IDENTITY COLUMN in the current connection.
Here is the background material on the topic
http://dev.mysql.com/doc/refman/5.0/en/getting-unique-id.html
+5
a source to share
Gets the ID of the last record inserted into the database. See here: http://www.kamath.com/tutorials/tut007_identity.asp
+1
a source to share