Board index » delphi » Key violation error message

Key violation error message

I wanted to use this code to prevent key violation problem:

procedure TRegnData.CustPostError(DataSet: TDataSet; E: EDatabaseError;
  var Action: TDataAction);
var
    ErrCode: DBResult;
begin
    ErrCode := 0;
    if E is EDBEngineError then
        with EDBEngineError(E) do
            ErrCode := Errors[ErrorCount-1].ErrorCode;
    if ErrCode = DBERR_KEYVIOL then
    begin
        <signal the problem/abort>
    end else
        Action := daFail;
end;

I put Dsintf in the uses clause, but when I compile it says it doesn't find
Dsintf.dcu.
I'm using D5 professional.

Thanks,
Tove

 

Re:Key violation error message


Quote
>I put Dsintf in the uses clause, but when I compile it says it doesn't find
>Dsintf.dcu.

EdbEngine Error is in DbTables
DBERR_KEYVIOL is in BDE or maybe BDEConst

--
Brian Bushay (TeamB)
Bbus...@NMPLS.com

Re:Key violation error message


Hi Tove
There has been  bug i Quick Report with multiple previews.
An update is awailable from http://www.qusoft.com
Regards
Knut

Tove <tove.bjornb...@c2i.net> skrev i
meldingsnyheter:8m3nub$h1...@bornews.borland.com...

Quote
> I wanted to use this code to prevent key violation problem:

> procedure TRegnData.CustPostError(DataSet: TDataSet; E: EDatabaseError;
>   var Action: TDataAction);
> var
>     ErrCode: DBResult;
> begin
>     ErrCode := 0;
>     if E is EDBEngineError then
>         with EDBEngineError(E) do
>             ErrCode := Errors[ErrorCount-1].ErrorCode;
>     if ErrCode = DBERR_KEYVIOL then
>     begin
>         <signal the problem/abort>
>     end else
>         Action := daFail;
> end;

> I put Dsintf in the uses clause, but when I compile it says it doesn't
find
> Dsintf.dcu.
> I'm using D5 professional.

> Thanks,
> Tove

Re:Key violation error message


I tried both BDE and BDEconst, but get error message 'Undeclared identifier
DBResult' when compiling the project, as I did with Dsintf. In Delphi Help I
found that those units are in the VCLD%50.BPL package (Borland Database
Components) which is included in Project Options|Design packages. Why do I
get the error?

Tove
"Brian Bushay TeamB" <BBus...@Nmpls.com> wrote in message
news:398a8f2b.46382214@forums.Inprise.com...

Quote

> >I put Dsintf in the uses clause, but when I compile it says it doesn't
find
> >Dsintf.dcu.

> EdbEngine Error is in DbTables
> DBERR_KEYVIOL is in BDE or maybe BDEConst

> --
> Brian Bushay (TeamB)
> Bbus...@NMPLS.com

Re:Key violation error message


if I use DBIResult and unit BDE, I get compilation error on my
Abort-statements. (E.g. in my datamodule in BeforeDelete events on som
tables, I display MessageDlg asking the user to confirm delete, if not I
call Abort). Can key-violation errors be trapped without using the BDE, if
not what do I use instead of Abort?

Tove

"Barry L. Birch" <amicus-bi...@gettheleadout.worldnet.att.net> wrote in
message news:8m6q4f$i9c2@bornews.borland.com...

Quote
> Tove:
> <<'Undeclared identifier DBResult'

> It's DBIResult, not DBResult, from BDE.

> --
> Barry L. Birch
> AMICUS custom software

> Please reply to newsgroups only unless invited to respond privately

Re:Key violation error message


Quote
In article <8mbo6m$3...@bornews.borland.com>, Tove wrote:
> if I use DBIResult and unit BDE, I get compilation error on my
> Abort-statements.

Use SysUtils.Abort instead.

 Mike Orriss (TeamB & Developer Express)
 (Unless stated otherwise, my replies relate to Delphi 5)
 (No unsolicited e-mail replies please)

Re:Key violation error message


On Thu, 3 Aug 2000 14:33:36 +0200, "Tove" <tove.bjornb...@c2i.net>
wrote:

Quote
>what do I use instead of Abort?

SysUtils.Abort.

Your call is conflicting with the BDE.ABORT constant so you need to
qualify the identifier with the unit name.

Jan

Other Threads