InternetTimeout Property Example (VB)

Microsoft ActiveX Data Objects (ADO)

RDS 2.5 API Reference

InternetTimeout Property Example (VB)

This example demonstrates the InternetTimeout property, which exists on the DataControl and DataSpace objects. This example uses the DataControl object and sets the timeout to 20 seconds.

'BeginInternetTimeoutVB

Public Sub Main()

On Error GoTo ErrorHandler

Dim dc As RDS.DataControl

Dim rst As ADODB.Recordset

Set dc = New RDS.DataControl

dc.Server = "http://MyServer"

dc.ExecuteOptions = 1

dc.FetchOptions = 1

dc.Connect = "Provider='sqloledb';Data Source='MySqlServer';" & _

"Initial Catalog='Pubs';Integrated Security='SSPI';"

dc.SQL = "SELECT * FROM Authors"

' Wait at least 20 seconds

dc.InternetTimeout = 200

dc.Refresh

' Use another Recordset as a convenience

Set rst = dc.Recordset

Do While Not rst.EOF

Debug.Print rst!au_fname & " " & rst!au_lname

rst.MoveNext

Loop

If rst.State = adStateOpen Then rst.Close

Set rst = Nothing

Set dc = Nothing

Exit Sub

ErrorHandler:

' clean up

If Not rst Is Nothing Then

If rst.State = adStateOpen Then rst.Close

End If

Set rst = Nothing

Set dc = Nothing

If Err <> 0 Then

MsgBox Err.Source & "-->" & Err.Description, , "Error"

End If

End Sub

'EndInternetTimeoutVB

See Also

DataControl Object (RDS) | DataSpace Object (RDS) | InternetTimeout Property (RDS)

© 1998-2003 Microsoft Corporation. All rights reserved.