我正在使用 odbc 通过 excel 连接到 mysql 数据库
这条线是做什么的?
Set rs = oConn.Execute("SELECT @@identity", , adCmdText)
我在更新数据库时遇到问题:
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
它只更新 .Fields("instrument") = "NA",但对于所有其他字段,它都放置 NULL 值
最佳答案
它选择(并返回)插入到当前连接中 IDENTITY COLUMN 中的最后一个值。
这里是关于这个主题的引用资料
http://dev.mysql.com/doc/refman/5.0/en/getting-unique-id.html
关于sql - select @@identity 是做什么的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2822260/