|
-
Jun 22nd, 2004, 02:35 PM
#1
Thread Starter
Frenzied Member
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:
catch ex as exception
'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.
-
Jun 22nd, 2004, 02:43 PM
#2
Frenzied Member
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.
-
Jun 22nd, 2004, 03:32 PM
#3
Frenzied Member
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.
-
Jun 23rd, 2004, 01:26 AM
#4
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.
-
Jun 23rd, 2004, 03:30 PM
#5
Thread Starter
Frenzied Member
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:
Public Const AdslConnStr As String = "Provider=MSDASQL.1;Persist Security Info=False; Extended Properties=" & _
"DRIVER={MySQL ODBC 3.51 Driver};DESC=;DATABASE=co;" & _
"SERVER=192.168.8.50;UID=root;PASSWORD=;PORT=;OPTION=;STMT=;"
Last edited by Andy; Jun 25th, 2004 at 07:07 AM.
-
Jun 23rd, 2004, 03:56 PM
#6
Sleep mode
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|