Subject | TIBOQuery RecordCount Problem/Bug? |
---|---|
Author | Linda Berry |
Post date | 2001-12-21T14:40:34Z |
I am having a problem with the TIBOQuery. I suspect it is a bug. If I am
doing something wrong please tell me.
Below you will find the test code. What happens when I watch the RecNo and
Record Count is as follows:
1. Before I do qryMain.First -- RecNo is 1 and RecordCount is 84
2. After executing qryMain.First; RecNo is 16 and RecordCount is 84.
3. Proceeding through the loop using qryMain.Next to move through the file
the RecNo increments each time until it reaches 84
and RecordCount is 84.
4. The qryMain.Next after RecNo is 84 results in RecordCount 1 and RecNo
84.
5. From then on the RecordCount on that query is 1.
I suspect that the intention was to make RecNo 1 and have RecordCount remain
84.
I have tried this with several tables and had the same kind of problem.
Please give me some idea what to do.
Thanks,
Linda
procedure TfrmBrowser.testqry(sFileName: string);
var
icol, irow: integer;
begin
if qryMain.Active then qryMain.Active := FALSE;
qryMain.SQL.Clear;
qryMain.SQL.Add('Select * From ' + sFileName);
qryMain.DisableControls;
qryMain.Active := TRUE;
qryMain.Filtered := (qryMain.Filter > '');
qryMain.EnableControls;
dbgrd.Options := dbgrd.Options + [dgRowSelect] - [dgEditing];
ds.DataSet := qryMain;
qryMain.DisableControls;
for iCol := 0 to (dbgrd.Columns.Count - 1) do
begin
qryMain.First;
for iRow := 0 to (qryMain.RecordCount - 1) do
begin
qryMain.Next;
end;
end;
end; // procedure
doing something wrong please tell me.
Below you will find the test code. What happens when I watch the RecNo and
Record Count is as follows:
1. Before I do qryMain.First -- RecNo is 1 and RecordCount is 84
2. After executing qryMain.First; RecNo is 16 and RecordCount is 84.
3. Proceeding through the loop using qryMain.Next to move through the file
the RecNo increments each time until it reaches 84
and RecordCount is 84.
4. The qryMain.Next after RecNo is 84 results in RecordCount 1 and RecNo
84.
5. From then on the RecordCount on that query is 1.
I suspect that the intention was to make RecNo 1 and have RecordCount remain
84.
I have tried this with several tables and had the same kind of problem.
Please give me some idea what to do.
Thanks,
Linda
procedure TfrmBrowser.testqry(sFileName: string);
var
icol, irow: integer;
begin
if qryMain.Active then qryMain.Active := FALSE;
qryMain.SQL.Clear;
qryMain.SQL.Add('Select * From ' + sFileName);
qryMain.DisableControls;
qryMain.Active := TRUE;
qryMain.Filtered := (qryMain.Filter > '');
qryMain.EnableControls;
dbgrd.Options := dbgrd.Options + [dgRowSelect] - [dgEditing];
ds.DataSet := qryMain;
qryMain.DisableControls;
for iCol := 0 to (dbgrd.Columns.Count - 1) do
begin
qryMain.First;
for iRow := 0 to (qryMain.RecordCount - 1) do
begin
qryMain.Next;
end;
end;
end; // procedure