Dim dbcon As New ADODB.Connection
Dim dbrec As New ADODB.Recordset
dbcon.Open "Provider=MSDASQL.1;Persist Security Info=False;Data Source=mySQL"
dbrec.CursorType = adOpenDynamic
dbcon.Excute("update myfile set name='AAA' where id='1'")
不知道為什麼無法執行.. :(
謝謝...
Dim dbrec As New ADODB.Recordset
dbcon.Open "Provider=MSDASQL.1;Persist Security Info=False;Data Source=mySQL"
dbrec.CursorType = adOpenDynamic
dbcon.Excute("update myfile set name='AAA' where id='1'")
不知道為什麼無法執行.. :(
謝謝...
文章標籤
全站熱搜

dbrec.CursorType = adOpenDynamic CursorType 好像只有adUseClient和adUseServer兩種
to jerry兄 adUseClient與adUseServer為CursorLocation而非CursourType to 生猛海鮮兄 基本上您可以不用設dbrec這個Recordset變數,因為在您的程式碼中沒看到其有作用 另dbcon.Excute("update myfile set name='AAA' where id='1'")這一行程式碼 在VB中為執行一個函數,而其有傳回值,但您沒有指定傳回值要設定給哪一個變數,因此會發生問題 這個問題和ADO沒關係,乃是在於VB執行Sub與Function的差別 你可以改成dbcon.execute "update myfile set name='AAA' where id='1'" 或是Call dbcon.Excute("update myfile set name='AAA' where id='1'") 詳細用法請參考紀文和大哥的網站 VB入門網,其中有說明
聽君一說, 可是, 還是無法執行... :( 說什麼錯誤在 Call Excute 那邊...
欄位名稱可能用到關鍵字 dbcon.Excute("update myfile set [name]='AAA' where [id]='1'")