Hi,
Since this is my first post, thanks to all the developers who work hard on Zeos-Lib!
I have a problem when I POST changes to a MySQL table in ZQuery that is sorting records via IndexFieldName, the record just posted will no longer be the active record it jumps to another record.
Now this problem only occours if the data is in a DBGrid (tried different types JvUltimGrid), if I have not grid and just use a Navigation bar, it does not appear to jump records (I did not test this too much as it was not going to be a solution)
I have found that by uncommenting the code below, from InternalPost in ZAbstractDataset.pas POSTing data works as it should but I cannot tell what adverse effects this may have by being removed.
BUG-FIX: bangfauzan addition}
if (SortedFields<>'') then begin
FreeFieldBuffers;
{SetState(dsBrowse);
Resync([]);
BM:=Bookmark;
DisableControls;
InternalSort;
BookMark:=BM;
EnableControls;}
end;
{end of bangfauzan addition}
Regards
Tristan
ZAbstractDataset InternalPost problem with IndexFieldNames
Moderators: EgonHugeist, mdaems
-
- Fresh Boarder
- Posts: 16
- Joined: 06.12.2006, 15:24
- Location: Perth - Western Australia
- Contact:
ZAbstractDataset InternalPost problem with IndexFieldNames
You do not have the required permissions to view the files attached to this post.
-
- Fresh Boarder
- Posts: 1
- Joined: 26.02.2015, 02:26
Re: ZAbstractDataset InternalPost problem with IndexFieldNames
Hi,
Someone have seen this problem? I have the same issue using Zeos lib 6.6.6 (stable).
You can used this example:
I have a dataset with 23 rows, with IndexFieldNames "nivel" and "seq" (nivel;seq).
11 of this rows have different nivel and seq.
Always I start an "while" in this dataset with edition, the post and next bring the pointer to the next "nivel and seq". So the "while" only execute 11 times.
The example is:
My ZQuery is connected in a DBGrid component.
Thanks for the help!
Daniel Madeira
Someone have seen this problem? I have the same issue using Zeos lib 6.6.6 (stable).
You can used this example:
I have a dataset with 23 rows, with IndexFieldNames "nivel" and "seq" (nivel;seq).
11 of this rows have different nivel and seq.
Always I start an "while" in this dataset with edition, the post and next bring the pointer to the next "nivel and seq". So the "while" only execute 11 times.
The example is:
Code: Select all
procedure TForm1.Button1Click(Sender: TObject);
var
x : Integer;
iFor : Integer;
function numero(dataset : Tdataset) : integer;
var
i : integer;
begin
i := 0;
dataset.first;
while not dataset.eof do
begin
dataset.edit;
dataset.fieldbyname('id_produto').asINteger := 0;
dataset.post;
inc(i);
dataset.next;
sleep(500);
end;
result := i;
end;
begin
zquery1.open;
zquery1.indexfieldnames := 'nivel;seq';
showmessage('recordcount = '+inttostr(zquery1.recordcount)+#13+'while = '+inttostr(numero(zquery1)));
end;
Thanks for the help!
Daniel Madeira