Key Violation no Interbase ???
26/05/2003
0
:arrow: Estou mudando os componentes da guia InterBase para dbExpress
:!: Uma rotina pega os dados de um arquivo .ini e joga no .gdb, mas está ocorrendo um erro ´Key Violation´ - isso acontecia muito no Paradox - após o ApplyUpdates(0)
:?: Alguém sabe o porque
*************************************************************
*************************************************************
*************************************************************
/* Table: PRNLPT, Owner: SYSDBA */
CREATE TABLE ´PRNLPT´
(
´CODIGO´INTEGER,
´TABELA´VARCHAR(25)
);
SET TERM ^ ;
/* Triggers only will work for SQL triggers */
CREATE TRIGGER ´TPRNLPT´ FOR ´PRNLPT´
ACTIVE BEFORE INSERT POSITION 0
as begin
new.Codigo = gen_id(GEN_PRNLPT, 1);
end
^
COMMIT WORK ^
SET TERM ;^
*************************************************************
*************************************************************
*************************************************************
Componentes :
SQLConnection - SQLDataSet - DataSetProvider - ClientDataSet
SQLDataSet
´CODIGO´ - ProviderFlags - [pfInUpdate,pfInWhere,pfInKey]
´TABELA´ - ProviderFlags - [pfInUpdate]
*************************************************************
*************************************************************
*************************************************************
with ClientDataSet do
begin
Append;
FieldByName(´Empresa´).AsString := Trim(EdEmpresa.Text);
FieldByName(´Tabela´).AsString := ArqIni.ReadString(Cabec, IntToStr(Cont) + ´Tabela´, ´´ );
Post;
ApplyUpdates(0);
end;
:!: Uma rotina pega os dados de um arquivo .ini e joga no .gdb, mas está ocorrendo um erro ´Key Violation´ - isso acontecia muito no Paradox - após o ApplyUpdates(0)
:?: Alguém sabe o porque
*************************************************************
*************************************************************
*************************************************************
/* Table: PRNLPT, Owner: SYSDBA */
CREATE TABLE ´PRNLPT´
(
´CODIGO´INTEGER,
´TABELA´VARCHAR(25)
);
SET TERM ^ ;
/* Triggers only will work for SQL triggers */
CREATE TRIGGER ´TPRNLPT´ FOR ´PRNLPT´
ACTIVE BEFORE INSERT POSITION 0
as begin
new.Codigo = gen_id(GEN_PRNLPT, 1);
end
^
COMMIT WORK ^
SET TERM ;^
*************************************************************
*************************************************************
*************************************************************
Componentes :
SQLConnection - SQLDataSet - DataSetProvider - ClientDataSet
SQLDataSet
´CODIGO´ - ProviderFlags - [pfInUpdate,pfInWhere,pfInKey]
´TABELA´ - ProviderFlags - [pfInUpdate]
*************************************************************
*************************************************************
*************************************************************
with ClientDataSet do
begin
Append;
FieldByName(´Empresa´).AsString := Trim(EdEmpresa.Text);
FieldByName(´Tabela´).AsString := ArqIni.ReadString(Cabec, IntToStr(Cont) + ´Tabela´, ´´ );
Post;
ApplyUpdates(0);
end;
Tadeu Pereira
Curtir tópico
+ 0
Responder
Clique aqui para fazer login e interagir na Comunidade :)