|
AnyDAC
|
Saves a dataset's data to a file.
|
Parameters |
Description |
|
const AFileName: String = '' |
An external file name. |
|
AFormat: TADStorageFormat = sfAuto |
A file format. |
Use SaveToFile to write a dataset's data to an external file for later use by this or other datasets.
AFileName is the name of the external file to save the data.
AFormat is the file format:
As option, you can specify ResourceOptions.PersistentFileName before calling Open. Then data will be saved to file at Close, if data was modified or file does not exists.
If file exists and ResourceOptions.Backup = True, then original file extension will be changed to ResourceOptions.BackupExt and it will be saved to ResourceOptions.BackupFolder. And then will be written a new file.
SaveToFile stores into the file the items specified by the ResourceOptions.StoreItems.
procedure SaveToFile(const AFileName: String = ''; AFormat: TADStorageFormat = sfAuto);
ADQuery1.Open('select * from customers');
ADQuery1.FetchAll;
ADQuery1.SaveToFile('c:\customers.xml', sfAuto);
....
ADMemTable1.LoadFromFile('c:\customers.xml', sfAuto);
ADMemTable1.Locate('CUSTOMER_ID', [100], []);|
What do you think about this topic? Send feedback!
|