brdrok
asked on
OleDb.... Exception handling
Hello,
is there a particular exception class that handles errors thrown by System.Data.OleDb?
thanks
is there a particular exception class that handles errors thrown by System.Data.OleDb?
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
OleDbExceptions are only thrown when something goes wrong at the server, for example invalid table name, non-existend column names, etc.
The error you create (not setting the select query) is an InvalidOperationException. It doesn't have anything to do with the actual database data, or table structures.
I think that when you enter something invalid in your sql query, like an invalid table name, the OleDbException will be thrown.
HTH,
Razzie
The error you create (not setting the select query) is an InvalidOperationException.
I think that when you enter something invalid in your sql query, like an invalid table name, the OleDbException will be thrown.
HTH,
Razzie
ASKER
Thanks Razzie for the very useful info.....
you rock....
you rock....
ASKER
thanks for the answer...got another question for you (increased point value to 100). why does the code go to the "Exception" as opposed to the "System.Data.OleDb.OleDbEx
try
{
string sqlString = "SELECT * FROM " + myRegion + " WHERE Status_FK = " + myStatus;
System.Data.OleDb.OleDbCon
System.Data.OleDb.OleDbDat
System.Data.DataSet myDS = new DataSet();
myDA.Fill(myDS, "ProgressReport"); <----Exception is thrown here and goes to the "Exception" catch block.
}
catch (System.Data.OleDb.OleDbEx
{
MessageBox.Show(oleEx.Mess
return;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message
return;
}
finally
{
//TODO: DO CLEAN UP HERE
}