Board index » cppbuilder » How do you catch errors & messages in ADO?

How do you catch errors & messages in ADO?


2005-05-08 06:18:28 PM
cppbuilder63
Hi,
I asked this a couple of weeks before, but without an answer
(Thread: TADOTable & TADOQuery: OnPost() errors...)
How do you know what to say to the user when you catch
some post/insert/delete error in ADO? I think that saying
"Some error occured" is not fair.
I do it now by analyzing the string in 'E->Message' (the more
details with code is in my original thread).
Is there anything better?
--
Best regards,
Vladimir Stefanovic
 
 

Re:How do you catch errors & messages in ADO?

Try to examine TADOConnection::Errors collection. It contains error
numbers - both COM and native (that goes from db server).
//------------------------------------------
Regards,
Vassiliev V. V.
www.managed-vcl.com - using .Net objects in Delphi for Win32 +
ADO.Net
www.oledbdirect.com - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)
"Vladimir Stefanovic" < XXXX@XXXXX.COM >сообщи?сообщила ?новостях
следующе? news: XXXX@XXXXX.COM ...
Quote
Hi,

I asked this a couple of weeks before, but without an answer
(Thread: TADOTable & TADOQuery: OnPost() errors...)

How do you know what to say to the user when you catch
some post/insert/delete error in ADO? I think that saying
"Some error occured" is not fair.

I do it now by analyzing the string in 'E->Message' (the more
details with code is in my original thread).

Is there anything better?



--
Best regards,
Vladimir Stefanovic

 

Re:How do you catch errors & messages in ADO?

Thanks!
--
Best regards,
Vladimir Stefanovic
"Viatcheslav V. Vassiliev" < XXXX@XXXXX.COM >wrote in message
Quote
Try to examine TADOConnection::Errors collection. It contains error
numbers - both COM and native (that goes from db server).

//------------------------------------------
Regards,
Vassiliev V. V.
www.managed-vcl.com - using .Net objects in Delphi for Win32 +
ADO.Net
www.oledbdirect.com - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)

"Vladimir Stefanovic" < XXXX@XXXXX.COM >сообщи?сообщила ?новостях
следующе? news: XXXX@XXXXX.COM ...
>Hi,
>
>I asked this a couple of weeks before, but without an answer
>(Thread: TADOTable & TADOQuery: OnPost() errors...)
>
>How do you know what to say to the user when you catch
>some post/insert/delete error in ADO? I think that saying
>"Some error occured" is not fair.
>
>I do it now by analyzing the string in 'E->Message' (the more
>details with code is in my original thread).
>
>Is there anything better?
>
>
>
>--
>Best regards,
>Vladimir Stefanovic
>


 

{smallsort}

Re:How do you catch errors & messages in ADO?

On Sun, 08 May 2005 22:57:06 +0300, Viatcheslav V. Vassiliev
< XXXX@XXXXX.COM >wrote:
Quote
Try to examine TADOConnection::Errors collection. It contains error
numbers - both COM and native (that goes from db server).

Could it be possible for somebody to provide with some sample code on how
to do this (e.g. trap errors)? I know it's only a few lines of code, but
it's a bit difficult for me. I don't use too much C++, I guess it's a
try/catch block, but I haven't been able to trap ADO errors.
BTW: I'm new on the forum, good to be here :)
Best regards,
George Nakos
--
Using Opera's revolutionary e-mail client: www.opera.com/mail/
 

Re:How do you catch errors & messages in ADO?

George,
Did you ever get a response to this? If not, try something like this:
try // this try closes the database if there are problems
{
try // this try catches your errors
{
ADOConnection1->Connect();
// do stuff with your connection
} catch (Exception* ex) {
MessageBox(NULL, ex->Message.c_str(), "DB Error", MB_OK);
}
}
__finally {
ADOConnection1->Close();
}
"George Nakos" < XXXX@XXXXX.COM >wrote in message
On Sun, 08 May 2005 22:57:06 +0300, Viatcheslav V. Vassiliev
< XXXX@XXXXX.COM >wrote:
Quote
Try to examine TADOConnection::Errors collection. It contains error
numbers - both COM and native (that goes from db server).

Could it be possible for somebody to provide with some sample code on how
to do this (e.g. trap errors)? I know it's only a few lines of code, but
it's a bit difficult for me. I don't use too much C++, I guess it's a
try/catch block, but I haven't been able to trap ADO errors.
BTW: I'm new on the forum, good to be here :)
Best regards,
George Nakos
--
Using Opera's revolutionary e-mail client: www.opera.com/mail/
 

Re:How do you catch errors & messages in ADO?

On Mon, 21 Nov 2005 19:07:16 +0200, poojo hackma <poojo.com/mail>wrote:
Quote
George,

Did you ever get a response to this? If not, try something like this:
I did, but thanks for the reply!
--
Using Opera's revolutionary e-mail client: www.opera.com/mail/