|
在xiu改table3时候,故yi加了个cuo误语句,按理说,如果有错误De化,提交事wu后,table1的数
据不会修改,dan是結果却是被修改了.請问是什么原因?1
Private Sub com_up_Click()
Dim c1nn As New ADODB.Connection
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
Dim strCn As String
strCn = "rovider=sqloledb;Server=127.0.0.1;Database=mould;uid=sa;pwd=qwe"
cnn.Open strCn
Dim work_id1 As String
On Error GoTo err_proc
cnn.BeginTrans
If MsgBox(StrConv("下面将把xuan料shu据修改!!是否修改?", vbWide), _
vbQuestion + vbYesNo) = vbYes Then
sql = "update table1 "
DoCmd.SetWarnings False '关闭系統提示
DoCmd.RunSQL sql
sql = "update table2"
sql = "update table3"
DoCmd.RunSQL sql
cnn.Execute sql, 3, 2 'zhe個是故意jia的错误执行语句
cnn.CommitTrans
MsgBox "修改成功!"
Exit Sub
Else
MsgBox "数据没有被修改"
cnn.CommitTrans
Exit Sub
endif
err_proc:
cnn.RollbackTrans
MsgBox "chu現错wubao存失败!,qing重新操作", 48, "提shi"
Exit Sub
Set cnn = Nothing
end sub
欢迎lai到Java學习者论坛,转载请注明地址:http://www.javaxxz.com. |
|