Fórum Append + Post não grava em banco #613309
23/11/2020
0
Utilizo o banco SQLite
Se alguem poder me auxiliar fico grato
Ramboli
Curtir tópico
+ 0Post mais votado
23/11/2020
Eduardo Silva
Gostei + 1
Mais Posts
23/11/2020
Ramboli
essa parte faço o Append
procedure TfEndEntrega.CarregaDados;
var
xSeqEnt : Integer;
begin
xSeqEnt := StrToIntDef(eSeqEnt.Text,0);
QryE085ENT.Close;
QryE085ENT.SQL.Text := ''SELECT * FROM E085ENT WHERE REPREG = :REPREG AND SITREG IN (''''A'''',''''I'''') AND CODCLI = :CODCLI AND SEQENT = :SEQENT AND SEQEXP = 0'';
QryE085ENT.ParamByName(''REPREG'').AsLargeInt := dm.E999CFG.FindField(''CODREP'').AsLargeInt;
QryE085ENT.FindParam(''CODCLI'').AsLargeInt := FCodCli;
QryE085ENT.FindParam(''SEQENT'').Value := xSeqEnt;
QryE085ENT.Open;
if (QryE085ENT.RecordCount = 0) then
begin
eSeqEnt.Text := IntToStr(xSeqEnt);
QryE085ENT.Post;
QryE085ENT.FindField(''codcli'').AsLargeInt := FCodCli;
QryE085ENT.FindField(''SEQENT'').AsInteger := GetMaxCod(''E085ENT'',''SEQENT'',''REPREG =''+IntToStr(dm.E999CFG.FindField(''CODREP'').AsLargeInt)+'' AND CODCLI = '' +eCodCli.Value.ToString);
end
else
begin
QryE085ENT.Edit;
end;
btnSalvar.Enabled := True;
btnCancelar.Enabled := True;
eSeqEnt.Enabled:=false;
if (QryE085ENT.RecordCount > 0) then
btnExcluir.Enabled := True;
end;
esse é o evento do botão
procedure TfEndEntrega.btnSalvarClick(Sender: TObject);
begin
try
QryE085ENT.Post;
StatusCampos(true);
StatusChave(true);
ClearCampos;
eSeqEnt.Enabled:=true;
eSeqEnt.SetFocus;
if (QryE085ENT.RecordCount > 0) then
btnExcluir.Enabled := True;
eSeqEnt.SetFocus;
except
on e : Exception do
Application.ShowException(e);
end;
end;
Gostei + 0
23/11/2020
Ramboli
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)