Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ODBC time-out 1

Status
Not open for further replies.

Periko

Programmer
Feb 24, 2003
134
BE
Hello,

i have an application that runs with a timer every one minute. Meanwhile, my application runs from 08h00 till 23h00. Every following morning, the first call to the recordset (ADO to odbc), i have an unspecified error. My application hangs on the first call to this recordset. I suspect that my CN(databaseconnection) is closed after several hours of inactivity. I programmed the following, however, no go :

Sel = "select * from sysparbeschikbaarheid"

If Cn.State = adStateClosed Then
Cn.Open
End If


Rs.Open Sel, Cn

My CN is opened normaly on the start of my application. Anybody a suggestion ?

Greetzzzzzz
Pedro...
 
Try this in your Timer Event:
dim MyTime1 As Date
Dim MyTime2 As Date

MyTime1= #11:01:00 PM#
MyTime2= #11:59:59PM#

If Time > MyTime1 then
If Time < MyTime2 then
Exit Sub
End if
End if

By using this mentality, your program is always running and should never have to restart...thus, hopefully, eliminating your error.

Hope this helps.

Ron

Ron Repp
 
Hello RonRepp,

I was not very clear, i suppose in my previous question.
What you said, is a very worthful tip, however this timer is not my problem. But the duration of the databaseconnection is.
In my loop, i don't close the database, but stays open. At the moment my loop begins again, the first attempt to open a recordset i have this problem. So, how can I check that my database is closed, so i can open it again ? I thought with the .state, but it does not the thing...

Pedro...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top