Re: [2005] What and Where
My guess is that the other computer that is accessing the database needs to trap the error of disconnection. Then it will have to send a message to your monitoring computer. I'd assume that you would build a service on the monitering computer and have the accessing computer connect to it thru sockets or ....
Re: [2005] What and Where
ic. my adviser told me that i should add a catch thing in every form so that when the connection gets lost while run time, a mesagebox vaidation will apear instead thax
Re: [2005] What and Where
Open the MSDN library, type try into the index and it will take you to the appropriate help. If you're using the online version then type try statement into the search box.
Re: [2005] What and Where
ok im having a hard time.. where in the codes in the form and what exactly should i put.. thanks
Re: [2005] What and Where
Have you read about the Try statement in the last 33 minutes? The code you want to try to execute goes in the Try block. The code you want to execute only if an exception is thrown goes in the Catch block. If there is cleanup code that must be executed whether the code succeeds or not, like closing a database connection, goes in the Finally block. If you don't know what those are then you haven't read the documentation. You have to do your share of the work.
Re: [2005] What and Where
my problem is where i should declare the statement im not sure where in my codes it should go in, what im trying to do is prvent a runtime error and instead show a messagebox when the server is suddenly disconnected
Re: [2005] What and Where
We have no idea where in your code it should go because we don't know anything about your code. If you already have existing code that is, or may, throw an exception then it doesn't have to move. You simply wrap the existing code in a Try block.
Re: [2005] What and Where
Why don't you ask your advisor instead?
Re: [2005] What and Where
You should use try, catch and finally (optional) within your connection form. Just read MSDN documentation about Try Catch statement. It explain in clearly.