Does a small example exist that shows how to save a table to an xml file and later load data from an xml file to the same table?
(I need this to exchange data between 2 locations)
Save and load xml
Hello,
To save a table to an XML file you have to use the SaveToXML procedure of the TUniTable component like this:
After that you can load this XML file into the TVirtualTable component like this:
Also you can use TUniDump to store data from tables as a script and to restore data from a received script. Please, take a look at the UniDAC demo.
To save a table to an XML file you have to use the SaveToXML procedure of the TUniTable component like this:
Code: Select all
UniTable.SaveToXML('your XML filename');
Code: Select all
VirtualTable.LoadFromFile('your XML filename');
You have to use the TCRBatchMove component to transfer data between all types of TDataSet descendants.
Here is an example:
Note that this component is placed on the Data Access page of the Component palette, not on the UniDAC page.
Here is an example:
Code: Select all
CRBatchMove.Destination := UniTable;
CRBatchMove.Source := VirtualTable;
CRBatchMove.Execute;
The TCRBatchMove component is transfering data between all types of the TDataSet descendants. So, you can use it for transfer data from the TQuery component to the TUniTable or TUniQuery components and backwards.
If you want to use the TUniQuery component to get access to your Paradox tables, then you can use an ODBC driver.
For that you have to do the following steps:
- set the TUniConnection.ProviderName property to ODBC;
- set the TUniConnection.SpecifyOptions.DSNType option to ntConnectionString;
- set the TUniConnection.LoginPromt property to False;
- set the TUniConnection.Server property to your ConnectionString.
Here an example of ConnectionString:
If you want to use the TUniQuery component to get access to your Paradox tables, then you can use an ODBC driver.
For that you have to do the following steps:
- set the TUniConnection.ProviderName property to ODBC;
- set the TUniConnection.SpecifyOptions.DSNType option to ntConnectionString;
- set the TUniConnection.LoginPromt property to False;
- set the TUniConnection.Server property to your ConnectionString.
Here an example of ConnectionString:
Code: Select all
Provider=MSDASQL.1;Persist Security Info=False;Extended Properties="CollatingSequence=ASCII;DefaultDir=E:\projects;Driver={Driver do Microsoft Paradox (*.db )};DriverId=538;FIL=Paradox 5.X;FILEDSN=E:\projects\pdx.db.dsn;MaxBufferSize=2048;MaxScanRows=8;PageTimeout=5;ParadoxNetPath=D:\WINDOWS\system32;ParadoxNetStyle=4.x;ParadoxUserName=admin;SafeTransactions=0;Threads=3;UID=admin;UserCommitSync=Yes;"