InternetTimeout Property Example (VB)

Microsoft ActiveX Data Objects (ADO)

InternetTimeout Property Example (VB)

This example demonstrates the InternetTimeout property, which exists on the DataControl and DataSpace objects. In this case, we'll just use the DataControl object and set the timeout to 20 seconds.

Sub Main()
    InternetTimeoutX
End Sub

Public Sub InternetTimeoutX()
Dim dc As New DataControl
Dim rst As ADODB.Recordset

dc.Server = "http://yourServer"
dc.Connect = "DSN=Pubs"
dc.SQL = "SELECT * FROM Authors"
dc.InternetTimeout = 20000  'Wait at least 20 seconds.
dc.Refresh
Set rst = dc.Recordset      'Use another Recordset as a convenience
While Not rst.EOF
    Debug.Print rst!au_fname & " " & rst!au_lname
    rst.MoveNext
Wend

rst.Close
End Sub