Re: ADO.NET Not Returning Error

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: William Ryan eMVP (dotnetguru_at_comcast.nospam.net)
Date: 04/30/04


Date: Fri, 30 Apr 2004 17:09:40 -0400

I'm using it with both the way you presented it and the one that QA can
parse. Here's the deal. when you hit dr.Read you blow up if you use the
incorrect one. You're fine otherwise. I'm catching the exception each time
as soon as I try read. If I do it with the cast, all is good.
"achobbs" <anonymous@discussions.microsoft.com> wrote in message
news:57AE5B56-CADE-4D3C-8B70-9D51FC664527@microsoft.com...
>
> **** Are you sure you aren't eating the exception? you are calling what,
> **** cmd.Execute??? Infomessage is only fired for certain severities so
you
> **** can'[t count on it.
>
> I am calling SqlCommand.ExecuteReader and trapping the call in a try with
a catch (Exception e) so the error should be captured if there is one. I
also get other info messages (not that this should show an info message),
but I get nothing back from ADO for this statement. No Exception, No
InfoMessage, and No DataReader. ADO should at least give me an error or
infomessage back since the statement essentially fails because of a
conversion error.
>
> **** I used this too and it worked fine:
> **** select
> **** 'CategoryID = ' +CAST( c.CategoryID AS VARCHAR)
> **** from
> **** northwind.dbo.Categories c
>
> Yes, the query is wrong but the situation is that we let people type in
queries and when a user types in a query of this format, they don't get
anything back and think they just didn't have any results when the actual
reason is that an error was in the sql statement that we weren't notified of
by ADO.
>
> Thanks,
>
> Ashton Hobbs
> http://www.mssqled.com
>
>



Relevant Pages

  • Re: ADO.NET Not Returning Error
    ... > a catch (Exception e) so the error should be captured if there is one. ... > also get other info messages, ... > but I get nothing back from ADO for this statement. ... > queries and when a user types in a query of this format, ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: ADO.NET Not Returning Error
    ... > a catch (Exception e) so the error should be captured if there is one. ... > but I get nothing back from ADO for this statement. ... > queries and when a user types in a query of this format, ...
    (microsoft.public.dotnet.framework.adonet)
  • D7 & ADO with ASA9: EOLEException & Multiple-step error
    ... If I rest my pointer over the ".AsString" part of AdoDataMod.aquGetClipReadOnly.FieldByName.AsString, I get the yellow ribbon hint with the text "Delphi Exception EoleException at ... I tried removing the fields from the ADO query, I tried adding them back in again, I tried closing everything and rebooting - so far so bad... ... The BDE version has been working with identical data for nearly 10 years without a hitch - it still is. ...
    (borland.public.delphi.database.ado)
  • Re: ADO seems to eat errors
    ... It seems that ADO interprets an exception raised within a SELECT-able ... I start with a very simple stored procedure which returns only ... Recordset has 1 row with 1 column. ...
    (microsoft.public.data.ado)
  • Re: Problems using ADO with multi threading
    ... ListIndexOutOfBounds is VCL (not MS ADO) exception, ... create new data module instance for every thread. ...
    (borland.public.delphi.database.ado)