作者: yodong 时间: 2010-12-1 19:03
'解决超时
Public Function selext(ByVal TmpSQLstmt As String)
On Error GoTo aa
Dim cmd As New ADODB.Command
Dim Cnn As New ADODB.Connection
cmd.CommandTimeout = 0
Set Cnn = CurrentProject.Connection
Set cmd.ActiveConnection = Cnn
'cmd.CommandType = adCmdStoredProc
cmd.CommandText = TmpSQLstmt
'MsgBox "Timeout on Connection: " & Cnn.CommandTimeout
'MsgBox "Timeout on Command: " & cmd.CommandTimeout 'Debug.Print
cmd.Execute
Set cmd = Nothing
Cnn.Close
Set Cnn = Nothing
'================
bb:
Exit Function
aa:
MsgBox Err.Description, vbInformation, sysstr
Resume bb
End Function
'================
暂时这样解决.到现在为止还没有出现提示.
朋友们还有其它的方法吗?作者: zhuyiwen 时间: 2010-12-1 21:09
呵呵,厉害作者: yodong 时间: 2010-12-2 19:39
呵呵!主要还是朱大哥给了提示:cmd.CommandTimeout = 0
所以还是要谢谢朱大哥.
也不知道这样是不是解决的方法.暂时是不提示超时了.不过,以前也是偶尔提示.