开发者

difference between cn.execute and rs.update?

i am connecting to mysql from excel using odbc. the following illustrates how i am updating the rs

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
开发者_StackOverflow社区    .Fields("batchstate") = "bstate"
    .Fields("instrument") = "NA"
    .Update ' stores the new record
End With

the question is why is there a need to run cn.execute after this? havent i already updated the rs with rs.update?


.Update in this example is used with a recordset to commit the record additions or changes. cn.Execute executes an sql string or command against the connection object (cn). You would not use both.


How are you connecting to the database? Are you using DAO, ADO, or RDO? Please post the code used to connect to the database. For examples of using either technology see: http://dev.mysql.com/doc/refman/5.0/en/connector-odbc-examples-programming.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜