 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Vladimir Stefanovic Guest
|
Posted: Sun May 08, 2005 10:18 am Post subject: How do you catch errors & messages in ADO? |
|
|
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
|
|
| Back to top |
|
 |
Viatcheslav V. Vassiliev Guest
|
Posted: Sun May 08, 2005 7:57 pm Post subject: 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.
http://www.managed-vcl.com - using .Net objects in Delphi for Win32 +
ADO.Net
http://www.oledbdirect.com - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)
"Vladimir Stefanovic" <antivari (AT) po (DOT) sbb.co.yu> сообщил/сообщила в новостях
следующее: news:427de773 (AT) newsgroups (DOT) borland.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
|
|
|
| Back to top |
|
 |
Vladimir Stefanovic Guest
|
Posted: Sun May 08, 2005 8:24 pm Post subject: Re: How do you catch errors & messages in ADO? |
|
|
Thanks!
--
Best regards,
Vladimir Stefanovic
"Viatcheslav V. Vassiliev" <support (AT) oledbdirect (DOT) com> wrote
| Quote: | Try to examine TADOConnection::Errors collection. It contains error
numbers - both COM and native (that goes from db server).
//------------------------------------------
Regards,
Vassiliev V. V.
http://www.managed-vcl.com - using .Net objects in Delphi for Win32 +
ADO.Net
http://www.oledbdirect.com - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)
"Vladimir Stefanovic" <antivari (AT) po (DOT) sbb.co.yu> сообщил/сообщила в новостях
следующее: news:427de773 (AT) newsgroups (DOT) borland.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
|
|
|
| Back to top |
|
 |
George Nakos Guest
|
Posted: Thu Aug 11, 2005 11:50 am Post subject: Re: How do you catch errors & messages in ADO? |
|
|
On Sun, 08 May 2005 22:57:06 +0300, Viatcheslav V. Vassiliev
<support (AT) oledbdirect (DOT) 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: http://www.opera.com/mail/
|
|
| Back to top |
|
 |
poojo hackma Guest
|
Posted: Mon Nov 21, 2005 5:07 pm Post subject: 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" <gnakos (AT) metronco (DOT) gr> wrote
On Sun, 08 May 2005 22:57:06 +0300, Viatcheslav V. Vassiliev
<support (AT) oledbdirect (DOT) 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: http://www.opera.com/mail/
|
|
| Back to top |
|
 |
George Nakos Guest
|
Posted: Tue Nov 22, 2005 10:46 am Post subject: 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: http://www.opera.com/mail/
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|