在MSDN有关Adodb.Connection的ConnectionTimeout的Remark中有描述如下:
"Make sure the provider to which you are writing code supports the ConnectionTimeout functionality."
另:在MSDN有关Adodb.Command的CommandTimeout的Remark中有描述如下:
The CommandTimeout setting on a Connection object has no effect on the CommandTimeout setting on a Command object on the same Connection; that is, the Command object's CommandTimeout property does not inherit the value of the Connection object's CommandTimeout value.
On a Connection object, the CommandTimeout property remains read/write after the Connection is opened.
就是这句了:
Public Sub toll_connect()
On Error GoTo errhandle
If toll_conn.State = adStateOpen Then
toll_conn.Close
End If
With toll_conn
.ConnectionString = GetConnectionStr()
.ConnectionTimeout = GetConnectionTimeout()
.CommandTimeout = GetCommandTimeout()
'.CursorLocation = adUseClient
MsgBox "ConnectionTimeout:" & toll_conn.ConnectionTimeout
.Open
End With
Exit Sub
errhandle:
MsgBox "数据库连接失败!"
End
End Sub