DBAdvGrid display one record double

Hello,


mostly the first record is displayed in the grid (pagemode = false) two times (in two rows). So the number of the last record is greater than the record count. The grid gets its information by a SQL-statement. What is to do to solve this problem?

Thank you

Jens

I found the solution:

A dbAdvGrid.Reload display the correct number of records.


Sorry, it's not solved - it works only one time. With the second refresh (grid.Beginupdate - grid.EndUpdate) I get one record two times again.


What is to do?

Do you please have some more details how to reproduce this?
Can this be reproduced with any of the demos we provide? If so, what steps to follow?

This is one example:


adbgMain.DataSource.DataSet.DisableControls;
if dmPaWo.qryPW.Active then dmPaWo.qryPW.Close;
dmPaWo.qryPW.SQL.Clear;
sQryCat := slCat.Values[slCat.Names[slbCat.ItemIndex]];

try
dmPaWo.qryPW.SQL.Add('SELECT p.*, c.CA_Name FROM PW p ');
dmPaWo.qryPW.SQL.Add('LEFT JOIN Category c ON p.CA_KEY = c.CA_KEY ');
if (Trim(sQryCat) <> '') then begin
dmPaWo.qryPW.SQL.Add('WHERE ((OP_KEY = ' + QuotedStr(sUser) + ') ');
dmPaWo.qryPW.SQL.Add('AND (CA_KEY = ' + QuotedStr(sQryCat) + ')) ');
end
else begin
dmPaWo.qryPW.SQL.Add('WHERE (OP_KEY = ' + QuotedStr(sUser) + ') ');
end;
if (Trim(sQrySort) <> '') then begin
if bAsc then begin
dmPaWo.qryPW.SQL.Add('ORDER BY ' + sQrySort);
end
else begin
dmPaWo.qryPW.SQL.Add('ORDER BY ' + sQrySort + ' DESC');
end;
end;
dmPaWo.qryPW.Open;

adbgMain.Reload;
adbgMain.DataSource.DataSet.EnableControls;

After the first call It displays the correct number of records, after all later one record two times. This is the same on another table with another DBAdvgrid. 
For the grids I set Rowselect = True and no editing of the cell, PageMode = False.

When I insert a new record to the dataset I refresh the grid with this (partial) method.
Without the Reloaf-function It displays always with the first call one row more.

It is not  clear what is causing this. 
Do you change anything wrt grid.FixedRows? Any other non-default grid settings?

If a problem persists, please provide some sample source app with which we can reproduce this problem here and send this by email https://www.tmssoftware.com/site/support_mail.asp

No fixed rows or cols. I will send you an E-mail with the dfm-part of the grid

I found a solution for the problem: If I remove the "Order by"-clause from the Query than it works correctly.

But now I have another Problem: At program start the query seraches for all records. If the user select a category the query searches fior all records only with the selected category. So I chnage the query. But the grid works still with the old query and displays all records. How can I tell the grid to use the new query?

Thank you.

When grid.PageMode = false, call grid.Reload

Thank you.