Set OLEDB Provider Timeout?

E

Ed Ardzinski

I found this code in a KB article to connect an ADO recordset to a form - it
seems to work fine. But some of the SQL Server queries are more complex than
others, and I am getting occasional timeout errors. It would *seem* to be a
simple fix, but I don't see any change in the timeout period:

(Access 2003 on a Win XP Pro box. pStr is being set to a valid SQL Statement
prior.)

Private Sub Form_Load()

Dim db As ADODB.Connection
Dim cmd As ADODB.Command
Dim rs As ADODB.Recordset

Dim rsa As ADODB.Recordset

Set db = New ADODB.Connection

With db
.Provider = "Microsoft.Access.OLEDB.10.0"
.Properties("Data Provider").Value = "SQLOLEDB"
.Properties("Data Source").Value = "******"
.Properties("User ID").Value = "******"
.Properties("Password").Value = "******"
.Properties("Initial Catalog").Value = "********"
End With

Set cmd = New ADODB.Command
cmd.CommandText = pStr

db.ConnectionTimeout = 0
db.Open
cmd.ActiveConnection = db

Set rs = New ADODB.Recordset
rs.Open cmd

---- So my question is can the timeout be set for this provider? And if so
where/how do I do it? TIA
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top