🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #2848

Re: How can I catch EDataBaseError : "Field '%s' must have a value"

#2848
From: Carlos
Date: Sat, 02 Dec 2006 12:40
55 lines
2762 bytes
Hello Vladimir,

I want do it on the system level. I don�t want rewrite a PostError event
for all components.

Thank you

"Vladimir Stefanovic" <antivari@po.sbb.co.yu> escribi� en el mensaje 
news:45706cdd$1@newsgroups.borland.com...
>> I would like silent this exception on global app.
>
> Do you have the source code, or you want to suppress
> that message on the system level ?
>
> If you have the source code, that depends on the database
> system you use. For example, for ADO:
>
> void __fastcall TDataModule::ADOTablePostError(TDataSet *DataSet,
>      EDatabaseError *E, TDataAction &Action)
> {
>   // No system error message
>   Action = daAbort;
>
>   // ... other checkings ...
>
>   // ...
>   if ( StrPos( E->Message.c_str(), "zero-length"                  ) ||
>        StrPos( E->Message.c_str(), "Null value"                   ) ||
>        StrPos( E->Message.c_str(), "must have a value"            ) ||
>        StrPos( E->Message.c_str(), "Error in row"                 ) ||
>        StrPos( E->Message.c_str(), "not a valid date"             ) ||
>        StrPos( E->Message.c_str(), "Datetime field overflow"      ) ||
>        StrPos( E->Message.c_str(), "related record is required "  ) ||
>        StrPos( E->Message.c_str(), "Empty row cannot be inserted" ) )
>   {
>      if ( StrPos( E->Message.c_str(), "SomeField" ) )
>      {
>         ShowMessage( "Field 'SomeField' must have a value" );
>         return;
>      }
>      if ( StrPos( E->Message.c_str(), "OtherField" ) )
>      {
>         // ... etc ...
>      }
>      ShowMessage( "Record must not be empty!\n\n" + E->Message );
>      return;
>   }
>   ShowMessage( "Unknown Error.\n\n" + E->Message );
> }
> -- 
> Best Regards,
> Vladimir Stefanovic
>
>
> 
Technical Details
Message-ID: <45717436$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newshub.sdsu.edu!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <457059b9@newsgroups.borland.com> <45706cdd$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,7a3f4138c63144de
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII
From: "Carlos" <a@a.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <457059b9@newsgroups.borland.com> <45706cdd$1@newsgroups.borland.com>
Subject: Re: How can I catch EDataBaseError : "Field '%s' must have a value"
Date: Sat, 2 Dec 2006 13:40:58 +0100
Lines: 57
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2869
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2962
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: 80.38.17.40
Message-ID: <45717436$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1165063222 80.38.17.40 (2 Dec 2006 04:40:22 -0700)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newshub.sdsu.edu!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail