tags:

views:

24

answers:

2

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
    .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?

+1  A: 

.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.

Remou
remou where have u been all my life?
I__
+1  A: 

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

Garett