Thursday, February 16, 2012

ADO Errors collection question.

(SQL Server 2000, SP3a)
Hello all!
I'm using ADO to reference a SQL Server 2000 database and was curious about the ADO
Connection Errors collection. It's my understanding that this object will contain both
errors *and* messages (like those produced by the Transact-SQL "print" statement). Is
there any way to differentiate between an error and a message from the ADO Error object?
Thanks for any help you can provide!
John PetersonHi John,
Try to add SET NOCOUNT ON as a very first statement inside of your SP. It
will remove all the messages from the result
--
Val Mazur
Microsoft MVP
Check Virus Alert, stay updated
http://www.microsoft.com/security/incident/blast.asp
"John Peterson" <j0hnp@.comcast.net> wrote in message
news:OQgk5hNwDHA.2076@.TK2MSFTNGP09.phx.gbl...
> (SQL Server 2000, SP3a)
> Hello all!
> I'm using ADO to reference a SQL Server 2000 database and was curious
about the ADO
> Connection Errors collection. It's my understanding that this object will
contain both
> errors *and* messages (like those produced by the Transact-SQL "print"
statement). Is
> there any way to differentiate between an error and a message from the ADO
Error object?
> Thanks for any help you can provide!
> John Peterson
>|||Thanks Val! I was looking for some way to determine whether the Error item was a bonafide
error, or just an informational message. I think I can make that determination by the
NativeError property. For messages, it seems to be 0 (sort of analogous to @.@.ERROR = 0).
"Val Mazur" <group51a@.hotmail.com> wrote in message
news:u1ZTJZSwDHA.2308@.TK2MSFTNGP11.phx.gbl...
> Hi John,
> Try to add SET NOCOUNT ON as a very first statement inside of your SP. It
> will remove all the messages from the result
> --
> Val Mazur
> Microsoft MVP
> Check Virus Alert, stay updated
> http://www.microsoft.com/security/incident/blast.asp
>
> "John Peterson" <j0hnp@.comcast.net> wrote in message
> news:OQgk5hNwDHA.2076@.TK2MSFTNGP09.phx.gbl...
> > (SQL Server 2000, SP3a)
> >
> > Hello all!
> >
> > I'm using ADO to reference a SQL Server 2000 database and was curious
> about the ADO
> > Connection Errors collection. It's my understanding that this object will
> contain both
> > errors *and* messages (like those produced by the Transact-SQL "print"
> statement). Is
> > there any way to differentiate between an error and a message from the ADO
> Error object?
> >
> > Thanks for any help you can provide!
> >
> > John Peterson
> >
> >
>|||Hi John!
I think that what constitutes an error vs message is pretty much up to each
individual's interpretation. QA, for instance only show text (and not the
red error stuff) for "messages" with severity level > 10. Perhaps ADO has
the same distinction regarding whether an exception is produced in the
application? (Should be easy to test.)
I would use the severity level if I would need to make such distinction
myself. A quick test with RAISERROR suggests that @.@.ERROR is indeed 0 for
severity level < 11, however.
--
Tibor Karaszi, SQL Server MVP
Archive at:
http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver
"John Peterson" <j0hnp@.comcast.net> wrote in message
news:uULJ99SwDHA.2712@.TK2MSFTNGP11.phx.gbl...
> Thanks Val! I was looking for some way to determine whether the Error
item was a bonafide
> error, or just an informational message. I think I can make that
determination by the
> NativeError property. For messages, it seems to be 0 (sort of analogous
to @.@.ERROR = 0).
>
> "Val Mazur" <group51a@.hotmail.com> wrote in message
> news:u1ZTJZSwDHA.2308@.TK2MSFTNGP11.phx.gbl...
> > Hi John,
> >
> > Try to add SET NOCOUNT ON as a very first statement inside of your SP.
It
> > will remove all the messages from the result
> >
> > --
> > Val Mazur
> > Microsoft MVP
> > Check Virus Alert, stay updated
> > http://www.microsoft.com/security/incident/blast.asp
> >
> >
> > "John Peterson" <j0hnp@.comcast.net> wrote in message
> > news:OQgk5hNwDHA.2076@.TK2MSFTNGP09.phx.gbl...
> > > (SQL Server 2000, SP3a)
> > >
> > > Hello all!
> > >
> > > I'm using ADO to reference a SQL Server 2000 database and was curious
> > about the ADO
> > > Connection Errors collection. It's my understanding that this object
will
> > contain both
> > > errors *and* messages (like those produced by the Transact-SQL "print"
> > statement). Is
> > > there any way to differentiate between an error and a message from the
ADO
> > Error object?
> > >
> > > Thanks for any help you can provide!
> > >
> > > John Peterson
> > >
> > >
> >
> >
>

No comments:

Post a Comment