Results 1 to 3 of 3

Thread: [2008] Comprehensive error handling for jmcilhinney's data access samples

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2008
    Posts
    515

    [2008] Comprehensive error handling for jmcilhinney's data access samples

    I'd like to request recommended error handling code for jmcilhinney's data access samples

    Thanks for any help

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

    Re: [2008] Comprehensive error handling for jmcilhinney's data access samples

    1. Look at the members I use and then read the documentation for those members and see what exceptions they can throw.
    2. Look at the situations that can cause those exceptions to be thrown and ask yourself whether that situation could reasonably occur in your app.
    3. For those exceptions that could reasonably occur, wrap the code in a Try block and Catch the exception.
    4. For blocks that can throw more than one type of exception AND you want to process those exceptions differently, add multiple Catch blocks.
    5. Make sure that, if one section of code depends on another, the second section will not execute if the first throws an exception, e.g. don't call ExecuteReader if calling Open on your connection threw an exception.

    Those are basically the rules of exception handling for any code. So, how about you try following them and show us the result?
    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

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2008
    Posts
    515

    Re: [2008] Comprehensive error handling for jmcilhinney's data access samples

    Sure thing. Will post the code asap.

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