메모

with recordset .update ...펌

맘편한넘 2013. 9. 8. 09:21

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?

share|improve this question

up vote 1 down vote accepted

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