2、如果遇到连接超时的错误,我们可以在程序中修改 Connection 对象的超时设置,再打开该连接。例如:
<% Set Conn = Server.CreateObject("ADODB.Connection") DSNtest="DRIVER={SQL Server};SERVER=ServerName;UID=USER;PWD=password;DATABASE=mydatabase" Conn. Properties("Connect Timeout") = 15 ''以秒为单位 Conn.open DSNtest %> |
Dim cn As New ADODB.Connection Dim rs As ADODB.Recordset . . . cmd1 = txtQuery.Text Set rs = New ADODB.Recordset rs.Properties("Command Time Out") = 300 ''同样以秒为单位,如果设置为 0 表示无限制 rs.Open cmd1, cn rs.MoveFirst . . . |