List:MySQL and .NET« Previous MessageNext Message »
From:Keith Dreibelbis Date:August 20 2007 11:46pm
Subject:Howto get an error back from an async query
View as plain text  
Hi mysql dotnet list,

 

I have started using the (v5.0.6.0) connector's asynchronous reader, and
it works pretty well.  But I can't figure out how to get a useful
exception back in case of an error, since EndExecuteReader only returns
a null.  For example:

 

mySqlCommand.CommandText = "SELECT this_sql_has_a_syntax_error FROM
atable";

IAsyncResult asyncResult = mySqlCommand.BeginExecuteReader();

// ...

IDataReader reader = mySqlCommand.EndExecuteReader(asyncResult);

if (reader == null) { 

                // something went wrong, but what?

}

 

The synchronous version, MySqlCommand.ExecuteReader, would throw some
sort of exception (probably a MySqlException) if something went wrong.
I figure the asynchronous call must have some way to get at this same
exception, but I can't figure out what it is.  Does anyone know how to
do this?  Thanks,

 

 

-kd

 


Thread
Howto get an error back from an async queryKeith Dreibelbis21 Aug
  • Re: Howto get an error back from an async queryReggie Burnett23 Aug
  • Re: Howto get an error back from an async queryReggie Burnett29 Aug