T
tshad
I have a situation where I could
Try
Open a Connection
ExecuteReader
Close Reader
Catch
may not happen - Possible if this a Timer in a Windows Service
End Try
The problem is that the connection and/or the Reader may be open when I get
to the "Open a Connection".
The Connection and Reader are Container objects in VS and are Global.
If the Sql Server is down, I may get bounced out of the Openning Connection
or ExecuteReader statement and never get to the Catch because the delay
waiting for a response may be longer that the Timer delay.
So when I come back, how do I handle the Connect and Reader before the "Open
a Connection" code?
I know I could do something like:
if SqlConnection1.State = "Open" then Close it
But what about the Reader?
Do I need to do something about it? I don't know if it is open or not.
Thanks,
Tom
Try
Open a Connection
ExecuteReader
Close Reader
Catch
may not happen - Possible if this a Timer in a Windows Service
End Try
The problem is that the connection and/or the Reader may be open when I get
to the "Open a Connection".
The Connection and Reader are Container objects in VS and are Global.
If the Sql Server is down, I may get bounced out of the Openning Connection
or ExecuteReader statement and never get to the Catch because the delay
waiting for a response may be longer that the Timer delay.
So when I come back, how do I handle the Connect and Reader before the "Open
a Connection" code?
I know I could do something like:
if SqlConnection1.State = "Open" then Close it
But what about the Reader?
Do I need to do something about it? I don't know if it is open or not.
Thanks,
Tom