Re: ADO.NET Not Returning Error
From: Ashton Hobbs (achobbs_at_hotmail.com)
Date: 05/01/04
- Next message: William Ryan eMVP: "Re: ADO.NET Not Returning Error"
- Previous message: James Candilora: "Re: Resourse Pool error"
- In reply to: William Ryan eMVP: "Re: ADO.NET Not Returning Error"
- Next in thread: William Ryan eMVP: "Re: ADO.NET Not Returning Error"
- Reply: William Ryan eMVP: "Re: ADO.NET Not Returning Error"
- Messages sorted by: [ date ] [ thread ]
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
> >
> >
>
>
- Next message: William Ryan eMVP: "Re: ADO.NET Not Returning Error"
- Previous message: James Candilora: "Re: Resourse Pool error"
- In reply to: William Ryan eMVP: "Re: ADO.NET Not Returning Error"
- Next in thread: William Ryan eMVP: "Re: ADO.NET Not Returning Error"
- Reply: William Ryan eMVP: "Re: ADO.NET Not Returning Error"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|