#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Location
    Montreal, Canada
    Posts
    486
    Rep Power
    12

    OleDbAdapter Error when program Start ? msgbox show


    Hi,

    I have a little problem in my program.

    I use OledbAdapter and Dataset etc... My problem is that when the program start the adapters try to connect to the SQL Database to populate de dataset etc...

    But my database is on a Sql Server and it's not everyone that have access to it. The Administrator have to give him the rights before he can access any tables. So if the user doesn't have the rights then a Pop-Up from Vb.Net tell the user that an error occured while connecting the OleDbAdapters.

    Instead of that message, I would like to put a message box that will tell my user that he doesn't have the right to connect to the SQL Server and to contact his network administrator.

    soo how does I do that ?

    I don't have access to the code of the Adapter that connect the dataset to the database. I would like to do a sort of Try Catch but when and where ?

    Anybody ever got a problem like that ? How you solve it ?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Location
    Montreal, Canada
    Posts
    486
    Rep Power
    12
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Location
    Montreal, Canada
    Posts
    486
    Rep Power
    12
    I have not been working on it for a while. But now I need to work on it, and I still don't know how I can solve that kinda little problem. It's damn stupid but users are stupid and I hate code 13, soo you try your best that it doesn't happens

    soo if anyone have any idea, your help will be appreciate.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Location
    Sheffield, UK
    Posts
    94
    Rep Power
    12
    Something like this:

    OleDbConnection1.Open()

    Try
    'your stuff here


    Catch ex As Exception 'error handling
    'tidy up
    OleDbConnection1.Close()
    MsgBox(ex.ToString)

    End Try

  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Location
    Montreal, Canada
    Posts
    486
    Rep Power
    12
    Thank You Pain for your help but I don't think I can do that.

    My problem occur before I can do any code. It's just itiliasize my form and then he create the object and when he create the oleadapters objects he bug there cause he don't have access. That's what it's look like.

    I will try to see what I can do. don't know how yet but were would be the fun if we don't need to do some research

IMN logo majestic logo threadwatch logo seochat tools logo