> Then will the following work when needing some kind of way to check and see
> if WinXP is in hibernation, or has otherwise closed the connection?
[quoted text clipped - 6 lines]
> 'Reopen connection
> End If
<snipped>
Ok, I'm with you now. It thought you just wanted to count connections.
Here's the bad news. ADO was not designed (like most libraries of the time)
were not inherently designed to operate in an disconnected state. (Unlike
ADO.Net) You have to write your own framework to manage it.
What you have above will likely appear in your solution, but it isn't the
whole story. Here are some general 'rules' or guidelines.
Open and Close connections immediately before and after you request
something.
Grab and keep as much data as possible in some intermediate storage -
arrays, disconnected recordsets, in the control, etc. ie, get in, grab, and
get out.
Have one Connection object or at least one 'Connection Manager'. Have it
detect hibernation and do whatever it has to do to to wake up again.
Confining the code to one spot will make it easier.
Never assume any connection is valid across messages, events, or at times
even functions. (Error handlers are your friend. <g>)
hth
-ralph
Dan Johnson - 25 Jan 2007 23:27 GMT
> Have one Connection object or at least one 'Connection Manager'. Have it
> detect hibernation and do whatever it has to do to to wake up again.
> Confining the code to one spot will make it easier.
So, having said that, if the following code summary is my
"ConnectionManager", will it do the job as far as knowing that a connection
has been lost, whether as a result of someone pulling the ethernet cable,
hibernation, or whatever? Maybe another way to say it -- will the Status
property always give me the correct result? (I ask because I thought I
remembered reading some time ago that this wasn't a foolproof method).
If Not Junk Is Nothing then
If Junk.Status = adStatusClosed then
'Reopen connection
End If
Else
'Reopen connection
End If
Thanks,
Dan
Ralph - 26 Jan 2007 00:39 GMT
> > Have one Connection object or at least one 'Connection Manager'. Have it
> > detect hibernation and do whatever it has to do to to wake up again.
[quoted text clipped - 18 lines]
>
> Dan
Answered in order... No, no, no, or no. Or another way to put it, no. <g>
You can search in this group for answers to each of your questions.
In general don't expect you can just continue on as though nothing has
happened. Best to assume you have to rebuild, test what is missing and
restore if necessary.
1) Th