Results 1 to 5 of 5

Thread: Catching an error for a missing ODBC driver...

  1. #1

    Thread Starter
    Lively Member milkmood's Avatar
    Join Date
    Mar 2005
    Location
    Forests of Delta Halo
    Posts
    109

    Question Catching an error for a missing ODBC driver...

    Where would I put a Try/Catch statement to check if a user has an ODBC driver for my app, and what exception do I use?

    CP

  2. #2

    Thread Starter
    Lively Member milkmood's Avatar
    Join Date
    Mar 2005
    Location
    Forests of Delta Halo
    Posts
    109

    Re: Catching an error for a missing ODBC driver...

    I'm putting this in the Form_Load routine since I already know it's an ODBC exception:

    VB Code:
    1. Dim odbcerr As New frmDriverError
    2.         Try
    3.             con.ConnectionString = "my;super;long;connection;string"
    4.         Catch ox As Odbc.OdbcException
    5.             odbcerr.ShowDialog()
    6.         End Try

    And so the frmDriverError form has a link to download the right driver.

    Is this the right place to put this?

    Thanks,
    CP
    When I say 'jump', don't waste time asking 'how high?'.

    Just a poor, dumb wanna-be programmer.

  3. #3
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: Catching an error for a missing ODBC driver...

    no because all you are doing there is setting a string property of the con object. You want to error catch when you actually try to use the connection. Generally this is when you call the OPEN method of the connection. That will throw an error if it fails, which is what you are going to want to catch

  4. #4

    Thread Starter
    Lively Member milkmood's Avatar
    Join Date
    Mar 2005
    Location
    Forests of Delta Halo
    Posts
    109

    Re: Catching an error for a missing ODBC driver...

    Perfect, thanks Matt.
    When I say 'jump', don't waste time asking 'how high?'.

    Just a poor, dumb wanna-be programmer.

  5. #5

    Thread Starter
    Lively Member milkmood's Avatar
    Join Date
    Mar 2005
    Location
    Forests of Delta Halo
    Posts
    109

    Re: Catching an error for a missing ODBC driver...

    Of course I don't know it if will really work because I can't duplicate the error on my machine because, naturally, I already have the drivers; or if I'm even directing the user to download the right thing... odbc_net.msi for connecting to a PostgreSQL db, but I think so.
    When I say 'jump', don't waste time asking 'how high?'.

    Just a poor, dumb wanna-be programmer.

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