本范例演示 DataControl 和 DataSpace 对象的 InternetTimeout 属性。在本范例中只使用 DataControl 对象,并将超时设置为 20 秒。
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
更多回帖