在对一数据库进行操作时,提示这个错误,请在家帮忙解决实时错误‘-2147217871(80040E31)’ Timeout expired我操作的语句如下:
strsql = "update persontable set dimission=1 where Pno='123'"
rs.Open strsql, strcn, adOpenKeyset, adLockPessimistic
strsql = "update persontable set dimission=1 where Pno='123'"
rs.Open strsql, strcn, adOpenKeyset, adLockPessimistic
CN.execute strsql
---------------------------------------------------------
代码中的 strcn是字符串吧??那个参数应该是数据库连接对象(cn),而不应该是连接字符串
同时要注意,连接对象要打开(cn.open "......")才能进行操作
strsql = "update persontable set dimission=1 where Pno='123'"
strcn.execute strsql
strsql = "update persontable set dimission=0 where Pno='123 '"
rst.Open strsql, strcn, adOpenKeyset, adLockPessimistic
MsgBox "OK"
Set rst = Nothing
Unload Me
End If
Else
If MsgBox("您确认要修改?", vbQuestion + vbYesNo) = vbYes Then
strsql = "update persontable set dimission=1 where Pno='123'"
rst.Open strsql, conn, adOpenKeyset, adLockPessimistic
MsgBox "OK!"
Set rst = Nothing
Unload Me
End If
End If