Sunday, February 19, 2012

Error message ID returned to the application

Hello,
I want to know whether I could get the Raiserror's message id in the front
end's application, (coded in Visual Basic or Delphi).
Thanks in advance
FrankFrank
Read up about sysmessages system table in the BOL
"Frank" <wangping@.lucent.com> wrote in message
news:%23VfqSgyPFHA.2252@.TK2MSFTNGP15.phx.gbl...
> Hello,
> I want to know whether I could get the Raiserror's message id in the front
> end's application, (coded in Visual Basic or Delphi).
> Thanks in advance
> Frank
>|||Hi Frank
To add to Uri's reply also check out severity levels in BOL. Getting the
value of the error will depend on what the front end application is e.g. ADO
has the ADOErrors collection.
John
"Frank" wrote:

> Hello,
> I want to know whether I could get the Raiserror's message id in the front
> end's application, (coded in Visual Basic or Delphi).
> Thanks in advance
> Frank
>
>|||Dimant,
Thanks for your quick response.
Actually here is the scenario,
I am using Delphi to access the SQL Server, and in my Delphi code, I need to
deal with errors which could come from the SQL Server, and in my Delphi
code, there are exception handlers like the following,
Try
something dealing with the SQL Server and something wrong
Except on E.Exception
If pos('Communication Like Failure', E.message)>0 then
//It is the connection error and do my error handling for connection.
End
And in the above pos('Communication Like Failure', E.message), I judge
whether the connection is broken or not only depend on whether the E.message
includes the 'Communication Like Failure' word.
What I think could be more accurate is that if I could get the error number
of the 'Communication Like Failure', and judge by the number.
Hope I have expressed well.
Thanks
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:etUmtkyPFHA.3384@.TK2MSFTNGP10.phx.gbl...
> Frank
> Read up about sysmessages system table in the BOL
>
> "Frank" <wangping@.lucent.com> wrote in message
> news:%23VfqSgyPFHA.2252@.TK2MSFTNGP15.phx.gbl...
front
>|||Hi
If you are using TADOConnection you can check the errors collection in
that. The NativeError attribute of each item will give the SQL Server
error number.
John|||Thanks John,
That works.
Frank
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:1113408160.705790.30670@.o13g2000cwo.googlegroups.com...
> Hi
> If you are using TADOConnection you can check the errors collection in
> that. The NativeError attribute of each item will give the SQL Server
> error number.
> John
>

No comments:

Post a Comment