Re: ADO.NET Not Returning Error
From: William Ryan eMVP (dotnetguru_at_comcast.nospam.net)
Date: 04/30/04
- Next message: Huan: "Transaction Commit TimeOut but Transaction still completes"
- Previous message: TonyT: "RE: .Net slow, SQL tools FAST??"
- In reply to: William Ryan eMVP: "Re: ADO.NET Not Returning Error"
- Next in thread: Ashton Hobbs: "Re: ADO.NET Not Returning Error"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 30 Apr 2004 18:08:44 -0400
I've tested this a bunch, can't find the documentation so it's a bit
counterintuitive, but it seems to be the case nonetheless.
"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: Huan: "Transaction Commit TimeOut but Transaction still completes"
- Previous message: TonyT: "RE: .Net slow, SQL tools FAST??"
- In reply to: William Ryan eMVP: "Re: ADO.NET Not Returning Error"
- Next in thread: Ashton Hobbs: "Re: ADO.NET Not Returning Error"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|