cn.execute和rs.update之间的区别?

我使用odbc从excel连接到mysql。 以下说明我如何更新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 .Fields("batchstate") = "bstate" .Fields("instrument") = "NA" .Update ' stores the new record End With 

问题是为什么在这之后需要运行cn.execute ? 还没有我已经更新rs与rs.update?

。此示例中的更新与logging集一起使用来提交logging添加或更改。 cn.Execute针对连接对象(cn)执行一个sqlstring或命令。 你不会同时使用这两个。

你如何连接到数据库? 你在使用DAO,ADO还是RDO? 请发布用于连接到数据库的代码。 有关使用任一技术的示例,请参阅: http : //dev.mysql.com/doc/refman/5.0/en/connector-odbc-examples-programming.html