select@@身份是做什么的?

我使用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值

它select(并返回)插入到当前连接的IDENTITY COLUMN中的最后一个值。

这里是主题的参考资料

http://dev.mysql.com/doc/refman/5.0/en/getting-unique-id.html

它检索您插入到数据库中的最后一条logging的标识。 看到这里: http : //www.kamath.com/tutorials/tut007_identity.asp

它从AUTO_INCREMENT列中检索最后插入的标识。 但是,我认为LAST_INSERT_ID()是在MYSQL中使用的正确函数。 我从来没有在文档中看到任何对@@ IDENTITY的引用。 我以为这只是一个SQL Server / Sybase结构。