Programming => General => Topic started by: greertr on January 11, 2017, 02:48:02 pm
Title: SQL Error
Post by: greertr on January 11, 2017, 02:48:02 pm
I went in to do an edit n my Lz program, and didn't do anything to any SQL stuff, and now, when I compile I get an error about the SQL Library called out of sequence. This error has been occurring randomly, then goes away, also randomly.
Here is a copy of my code that seems to be causing the problem...
Label1.caption:='Number of Records: '+ inttostr(ZQuery1.RecordCount-1);
Label2.caption:='Number of Selected Record: '+ inttostr(ZQuery1.RecNo);
end;
Anyone know what I need to do to correct this?
Title: Re: SQL Error
Post by: patyi on January 11, 2017, 06:36:19 pm
procedure TForm12.FormCreate(Sender: TObject); begin if ZQuery1.Active then begin Label1.caption := 'Number of Records: ' + inttostr(ZQuery1.RecordCount-1); Label2.caption := 'Number of Selected Record: ' + inttostr(ZQuery1.RecNo); end; end;
Title: Re: SQL Error
Post by: greertr on January 11, 2017, 10:16:00 pm
thx!
Title: Re: SQL Error
Post by: mangakissa on January 12, 2017, 09:19:53 am
Why using 'ZQuery1.RecordCount-1'? Recordcount gives the actual count of records.
Don't put it in formcreate. It only shows once, but you want to see the selected recordnumber everytime you change the record. Create a procedure like this: