>I want to prompt a message box when the program is disconnect to Database. I should how to trigger this event in right method? >Or i should use try...catch ex as exception ....End try in any connection fuction, but how to compare disconnect condition,because exception any >error will run?
Catch the exception when you try to open the connection. You don't need to specify any particular error in your catch ... any error at all will mean you can't connect.