Article ID: 188858
Article Last Modified on 3/2/2005
'Assuming a connection object has been established
With oCm
Set .ActiveConnection = oCn
.CommandText = "select * from authors"
.CommandType = adCmdText
.CommandTimeout = 10
End With
With oRs
.CursorLocation = adUseClient
.Open oCm
End With
Dim oCn As Connection
Dim oRs As Recordset
Dim oCm as Command
Set oCn = New Connection
Set oRs = New Recordset
Set oCm = New Command
With oCn
.ConnectionString = "PROVIDER=SQLOLEDB;" & _
"DATA SOURCE=<server>;" & _
"Initial Catalog=pubs;" & _
"User Id=<username>;Password=<strong password>"
.Open
End With
'Create a Stored Procedure on SQL Server that causes a delay.
With oCM
Set .ActiveConnection = oCn
.CommandText = "Create Procedure MyWait AS " & _
"waitfor delay '00:00:15'"
.CommandType = adCmdText
.Execute
End With
'The Command Time out does not occur.
With oRs
Set .ActiveConnection = oCn
.CursorLocation = adUseClient
.Properties("Command Time out") = 5
.Open "MyWait"
End WithKeywords: kbbug kbdatabase kbprb kbpending KB188858