BUG: Refresh Method of Data control Resets QueryTimeoutID: Q176258
|
The QueryTimeout property of the Database object determines the number of seconds to wait before a timeout occurs when a query is executed. If the DefaultType property of the Data control is set to dbUseODBC, then the QueryTimeout property of the Database object is reset to the default value of 30 when the Refresh method of the Data control is performed.
There are several ways to work around this problem, two of which are listed
here:
Private ws As Workspace
Private db As Database
Private Sub Command1_Click()
Dim con As String
Dim sql As String
con = "ODBC;DSN=your_dsn;UID=sa;PWD=;DATABASE=pubs"
Set ws = DBEngine.CreateWorkspace("", "", "", dbUseODBC)
Set db = ws.OpenDatabase("", Connect:=con)
db.QueryTimeout = 60
sql = "SELECT * FROM Authors"
Set Data1.Recordset = db.OpenRecordset(sql, dbOpenDynaset)
MsgBox db.QueryTimeout
End Sub
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available.
Private Sub Command1_Click()
Data1.Database.QueryTimeout = 60
Data1.RecordSource = "SELECT * FROM Authors"
Data1.Refresh
MsgBox Data1.Database.QueryTimeout
End Sub
Private Sub Form_Load()
Data1.DefaultType = dbUseODBC
Data1.Connect = "ODBC;DSN=your_dsn;UID=sa;PWD=;DATABASE=pubs"
Data1.Refresh
End Sub
Keywords : kbVBp500 VBKBCtrl VBKBDB
Version : WINDOWS:5.0
Platform : WINDOWS
Issue type : kbbug
Last Reviewed: June 24, 1999