I think the best way to deal with connection errors is to cacth them and try
to re-open the connection. As Bill mentioned there is no way to know for
sure whether the connection is ok or not.
"John" <John@nospam.infovis.co.uk> wrote in message
news:%2388azIejHHA.5084@TK2MSFTNGP03.phx.gbl...
> So if it is closed for anyone reason it can be re-opened before executing
> a query. Sort of trying to avoid the above mentioned error.
>
> Regards
>
> "Miha Markic" <miha at rthand com> wrote in message
> news:FD6A24A0-1861-45F7-838E-3F6986707AE2@microsoft.com...
>> Why do you need to check its status anyway?
>>
>> --
>> Miha Markic [MVP C#, INETA Country Leader for Slovenia]
>> RightHand .NET consulting & development
www.rthand.com >> Blog:
http://cs.rthand.com/blogs/blog_with_righthand/ >>
>> "John" <John@nospam.infovis.co.uk> wrote in message
>> news:enIrbxZjHHA.4188@TK2MSFTNGP02.phx.gbl...
>>> Hi
>>>
>>> I am creating a db connection using the below code. Is there a way to
>>> check if the connection is open?
>>>
>>> Thanks
>>>
>>> Regards
>>>
>>>
>>> = Code Below ====================
>>>
>>> Dim LocalConn As OleDb.OleDbConnection
>>> Dim St As String = My.Settings.LocalDBConnectionString
>>>
>>> LocalConn = New OleDb.OleDbConnection(St)
>>> LocalConn.Open()
>>>
>>>
>>
>
>