Error copying data in a DBGrid control to another using Zeos
Posted: 03.02.2015, 03:10
Hello all,
I'm using the code below, to copy data from a dbgrid control to the other, this showing this error: bookmark was not found
I'm using Lazarus 1.2.6 with FPC 2.6.4 and Zeos Components windows 7 32.
What pose be wrong?
The code I am using is this:
procedure Tfrmprodgrupo.btnadicionaClick(Sender: TObject);
var
Idx: integer;
begin
try
if dbgprod.SelectedRows.Count > 0 then
begin
for Idx := 0 to dbgprod.SelectedRows.Count - 1 do
begin
// posiciona o dataset de origem no "n" registro selecionado
qryprod.GotoBookmark(pointer(dbgprod.SelectedRows.Items[Idx]));
// move os dados do dataset de origem para destino aqui
qrygrupo.Append;
qrygrupocd_fil.AsInteger := dmcad.filial;
qrygrupocd_grupo_trib.AsInteger := StrToInt(dbedtgrupo.Text);
qrygrupocd_prod.Value := qryprodcd_prod.Value;
qrygruponm_usuinc.AsString := frmmenu.usuariolog;
qrygrupodt_usuinc.AsDateTime := (Date + Time);
qrygrupo.Post;
qryprod.Refresh;
qrygrupo.Refresh;
qrycontprod.Close;
qrycontprod.Open;
qrycont2.Close;
qrycont2.ParamByName('cd_fil').AsInteger := dmcad.filial;
qrycont2.ParamByName('cd_grupo').AsInteger := StrToInt(dbedtgrupo.Text);
qrycont2.Open;
end;
end;
except
on E: Exception do
begin
raise Exception.Create('Ocorreu um erro:' + #13 + E.message);
end;
end;
I'm using the code below, to copy data from a dbgrid control to the other, this showing this error: bookmark was not found
I'm using Lazarus 1.2.6 with FPC 2.6.4 and Zeos Components windows 7 32.
What pose be wrong?
The code I am using is this:
procedure Tfrmprodgrupo.btnadicionaClick(Sender: TObject);
var
Idx: integer;
begin
try
if dbgprod.SelectedRows.Count > 0 then
begin
for Idx := 0 to dbgprod.SelectedRows.Count - 1 do
begin
// posiciona o dataset de origem no "n" registro selecionado
qryprod.GotoBookmark(pointer(dbgprod.SelectedRows.Items[Idx]));
// move os dados do dataset de origem para destino aqui
qrygrupo.Append;
qrygrupocd_fil.AsInteger := dmcad.filial;
qrygrupocd_grupo_trib.AsInteger := StrToInt(dbedtgrupo.Text);
qrygrupocd_prod.Value := qryprodcd_prod.Value;
qrygruponm_usuinc.AsString := frmmenu.usuariolog;
qrygrupodt_usuinc.AsDateTime := (Date + Time);
qrygrupo.Post;
qryprod.Refresh;
qrygrupo.Refresh;
qrycontprod.Close;
qrycontprod.Open;
qrycont2.Close;
qrycont2.ParamByName('cd_fil').AsInteger := dmcad.filial;
qrycont2.ParamByName('cd_grupo').AsInteger := StrToInt(dbedtgrupo.Text);
qrycont2.Open;
end;
end;
except
on E: Exception do
begin
raise Exception.Create('Ocorreu um erro:' + #13 + E.message);
end;
end;