Dataset.LoadFromFile |
Top Previous Next |
Syntax function Dataset.LoadFromFile(ADataset: pointer; AFilename: string): boolean
Alternative Names
Description Loads data previously saved into dataset ADataset from a file named AFilename, returns TRUE if successful, FALSE otherwise. The file is a binary file created using Dataset.SaveToFile.
Note that the dataset variable needs to exist and needs to have a certain structure, see the example below.
See also
Example execute udsblock returns (output_data varchar(100) ) as begin /* create the data set */ select employeeid, emp_name, salary, bonus_perc from test_data order by employeeid as dataset mydata;
try Dataset.SaveToFile(mydata, 'c:\data\mydata.bin'); finally Dataset.Close(mydata); end
/* create the dataset structure, but it's empty (because of the WHERE clause) */ select employeeid, emp_name, salary, bonus_perc from test_data where 1 = 0 as dataset mydata;
try Dataset.LoadFromFile(mydata, 'c:\data\mydata.bin'); Dataset.First(mydata); while not Dataset.EOF(mydata) do begin output_data = Dataset.FieldValue(mydata, 'emp_name'); suspend; Dataset.Next(mydata); end finally Dataset.Close(mydata); end; end |