在对一数据库进行操作时,提示这个错误,请在家帮忙解决实时错误‘-2147217871(80040E31)’ Timeout expired我操作的语句如下:
strsql = "update persontable set dimission=1 where Pno='123'"
rs.Open strsql, strcn, adOpenKeyset, adLockPessimistic

解决方案 »

  1.   

    strsql = "update persontable set dimission=1 where Pno='123'"
    CN.execute strsql
      

  2.   

    rs.Open strsql, strcn, adOpenKeyset, adLockPessimistic
    ---------------------------------------------------------
    代码中的 strcn是字符串吧??那个参数应该是数据库连接对象(cn),而不应该是连接字符串
    同时要注意,连接对象要打开(cn.open "......")才能进行操作
      

  3.   

    超时错,因为这个语句是没有记录集返回的,应该
    strsql = "update persontable set dimission=1 where Pno='123'"
    strcn.execute strsql
      

  4.   

    回复 All,一样的,还是提示:超时已过期。请教有什么更好的方法去解决吗?
      

  5.   

    我的原语句如下,在等于0时是正常操作的,但等于1时就提示超时,而且如果把第一个IF的改为1也是正常的,不知为什么?If me.caption= "0" Then   If MsgBox("您确认要修改?"), vbQuestion + vbYesNo) = vbYes Then
           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