Re: ADO.NET Not Returning Error

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

From: Ashton Hobbs (achobbs_at_hotmail.com)
Date: 05/01/04


Date: Fri, 30 Apr 2004 20:55:14 -0400

That was it.

I was using .NET 1.1 so I was checking HasRows and if it was false I wasn't
reading. When I called Read I got the SqlException.

Any reason that the SqlException didn't happen on the call to ExecuteReader
but did happen when trying to read from the reader???

Thanks,

Ashton Hobbs
http://www.mssqled.com

"William Ryan eMVP" <dotnetguru@comcast.nospam.net> wrote in message
news:%232yGVbvLEHA.2976@TK2MSFTNGP10.phx.gbl...
> 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. ... 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: ODBC query in VB code Need HELP
    ... Everything for ADO is in the first 2 messages that I gave you. ... Since your pass-through query already exists (including the ... Dim STRSQL As String ...
    (microsoft.public.access.formscoding)
  • Re: Default values of functions
    ... query: TGCQuery; ... exception, the return value would be that value. ... So I agree that the return value of this function could be undefined if the assignment is ignored by the compiler. ... If the calling code called the function inside a "try" section, then execution, upon leaving the called function, will go to the "finally" section of the caller, if there is one, or to the "except" section of the caller, if there is one with the appropriate exception type. ...
    (comp.lang.pascal.delphi.misc)
  • Re: Connecting to Query
    ... practice examples of the ADO Command, Parameters, etc. you explained below. ... Second, with the selected territory ... >> combo box to select a product from a query based primarily on a link ...
    (microsoft.public.access.formscoding)