BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How do you catch errors & messages in ADO?

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder Databases (ADO)
View previous topic :: View next topic  
Author Message
Vladimir Stefanovic
Guest





PostPosted: Sun May 08, 2005 10:18 am    Post subject: How do you catch errors & messages in ADO? Reply with 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
Viatcheslav V. Vassiliev
Guest





PostPosted: Sun May 08, 2005 7:57 pm    Post subject: Re: How do you catch errors & messages in ADO? Reply with 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...
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





PostPosted: Sun May 08, 2005 8:24 pm    Post subject: Re: How do you catch errors & messages in ADO? Reply with quote



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





PostPosted: Thu Aug 11, 2005 11:50 am    Post subject: Re: How do you catch errors & messages in ADO? Reply with quote

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





PostPosted: Mon Nov 21, 2005 5:07 pm    Post subject: Re: How do you catch errors & messages in ADO? Reply with quote

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





PostPosted: Tue Nov 22, 2005 10:46 am    Post subject: Re: How do you catch errors & messages in ADO? Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder Databases (ADO) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.