こんにちは、OEです。
[環境]Delphi10 Seattle / Windows7
FireDACで SQLite にSelect文を行うと、
FDQuery1.RecordCount で得られる値が最大でも50で
頭打ちになってしまうのですね。
これを回避して正確なレコード数を得たいのですが、
今は while not FDQuery1.Eof do で回して数えています。
もし何かスマートな方法とか、根本的に解決する方法とか
ありましたら教えて頂けると助かります。
よろしくお願いいたします。
//-----------------------------------------------
procedure TForm1.Button1Click(Sender: TObject);
var
i : integer;
begin
FDConnection1.Params.Clear;
FDConnection1.Params.Add('DriverID=SQLite');
//SQLite Sample Database
//
http://www.sqlitetutorial.net/sqlite-sample-database/
FDConnection1.Params.Add('Database='
+ ExtractFilePath(Application.Exename)+'chinook.db');
FDPhysSQLiteDriverLink1.VendorLib :=
ExtractFilePath(Application.Exename)+'sqlite3.dll';
try
FDConnection1.Connected := True;
except
FDConnection1.Close;
Exit;
end;
FDQuery1.Connection := FDConnection1;
FDQuery1.Open('SELECT * FROM customers;');
ShowMessage(IntToStr(FDQuery1.RecordCount)); //50で頭打ち
while not FDQuery1.Eof do
begin
inc(i)
FDQuery1.Next;
end;
ShowMessage(IntToStr(i)); //正確なレコード数が表示される
FDQuery1.Close;
FDConnection1.Close;
end;
MLホームページ:
https://www.freeml.com/delphi-users
----------------------------------------------------------------------
Powered by freeml --
https://www.freeml.com/ --
------------------------------------------------------[freeml byGMO]--
あなたの街のチラシがいつでも無料で見放題!
チラシをクリックしてチラシが拡大されたらポイントゲット♪
まずはかんたん登録♪ -ポイントタウン-
https://www.pointtown.com/ptu/rd.cgi?cid=8912
----------------------------------------------------------------------