Results 1 to 6 of 6

Thread: catching errors [RESOLVED]

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2003
    Posts
    1,489

    catching errors [RESOLVED]

    what exception should I use to catch "BOF or EOF or record deleted". Pretty much when there is not a row in the db.

    I thought of using
    VB Code:
    1. catch ex as exception
    2.  'compare ex.message to a literal

    but didn't know how efficietnt that would be.

    I should probably point out that i'm using ado and not ado.net net for this operation. due to the type of connection i have to use.
    Last edited by Andy; Aug 13th, 2004 at 12:04 PM.

  2. #2
    Frenzied Member
    Join Date
    Mar 2004
    Location
    Orlando, FL
    Posts
    1,618
    Step through it with the debugger, put a break point in the generic exception, and see what exception it throws when there are no rows. Out of curiosity, why aren't you just handling if MyRecordSet.EOF = true in code instead of waiting for an exception to be thrown?
    Sean

    Some days when I think about the next 30 years or so of my life I am going to spend writing code, I happily contemplate stepping off a curb in front of a fast moving bus.

  3. #3
    Frenzied Member
    Join Date
    Feb 2003
    Location
    Argentina
    Posts
    1,950
    It's probably something like System.NullDB.Exception (just a guess, don't have vb here). The help file could probably tell you. Or, for fun, write your own exception class.

  4. #4
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    What connection trouble makes you use ADODB? Also it would be a COMException but all exceptions thrown from ADODB are of type COMException so you should Check IndexOf("BOF")>-1 to see if its a BOF error.

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2003
    Posts
    1,489
    Originally posted by Edneeis
    What connection trouble makes you use ADODB? Also it would be a COMException but all exceptions thrown from ADODB are of type COMException so you should Check IndexOf("BOF")>-1 to see if its a BOF error.
    well, i could be going about it the wrong way but i'm connecting to MySQL and using an ip address in my connection string. is it possible to connect like that with ado.net and use a reader? that would be great

    for reference, here is the connection string i'm using:
    VB Code:
    1. Public Const AdslConnStr As String = "Provider=MSDASQL.1;Persist Security Info=False; Extended Properties=" & _
    2.                                          "DRIVER={MySQL ODBC 3.51 Driver};DESC=;DATABASE=co;" & _
    3.                                          "SERVER=192.168.8.50;UID=root;PASSWORD=;PORT=;OPTION=;STMT=;"
    Last edited by Andy; Jun 25th, 2004 at 07:07 AM.

  6. #6
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    If you're using ODBC class , then use Odbc.OdbcException method to handle any error returned from the ODBC datasource .
    As for the reader obj , you have also ODBC reader obj , you can use it .

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