Results 1 to 10 of 10

Thread: [2005] What and Where

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2007
    Posts
    258

    [2005] What and Where

    Hi, i need help in making a validation msg box come up when the main server suddenly disconnects while accessing it from another computer.. im using SQL and VB 05.. where and what do i declare in my forms so that it wont go runtime and instead show up a msg box saying something like "server is disconnected?" thanks

  2. #2
    Hyperactive Member
    Join Date
    Mar 2006
    Posts
    413

    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 ....
    Visual Studio .NET 2005/.NET Framework 2.0

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2007
    Posts
    258

    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

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2007
    Posts
    258

    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

  6. #6
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2007
    Posts
    258

    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

  8. #8
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  9. #9
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: [2005] What and Where

    Why don't you ask your advisor instead?

  10. #10
    Addicted Member
    Join Date
    Sep 2006
    Location
    Surabaya, Indonesia
    Posts
    163

    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.
    Check my Blog at VB Corner,Component Crafts

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width