How to prevent Delphi ADO from loading the entire table into memory?

前端 未结 7 2167
后悔当初
后悔当初 2021-02-09 01:22

I am not a Delphi programmer, but I I got an old Delphi 7 application that I need to fix and it is using ADO.

The database table (MS Accesss) contains +100,000 rows and

7条回答
  •  遥遥无期
    2021-02-09 01:36

    1. On your datamodule where "MeasurementsADOTable" currently resides, drop a TADOQuery and name it "MeasurementsADOQuery"
    2. Set the Connection property of MeasurementsADOQuery to MyADOConnection (assuming this is the case based on the little code snippet provided.)
    3. I'm also assuming that you are displaying a grid or otherwise using a DataSource - change the DataSource component's "DataSet" property from MeasurementsADOTable to MeasurementsADOQuery
    4. Edit the actual query to be executed by setting the SQL property of MeasurementsADOQuery. (In runtime before opening: Measurements.SQL.Text := 'select top 10 * from measurements order by whatever')
    5. Analyze/change all references in code from MeasurementsADOTable to MeasurementsADOQuery

提交回复
热议问题