问题
Warning: total rewrite.
Scenario:
I loaded some data from database on a TCustomADODataset descendant. After that, I saved this data on XML temp file (using TCustomADODataset.SaveToFile) to allow getting the XML data as a string and store it on a database table as text blob - it's an exports table.
Another program (different from the one that stored the XML) will take that data, show the elements inside, and allow an user to select which element to import to the main database schema.
Problem:
The problem with the approach above is the need of temporary files to allow TCustomADODataset use the LoadFromFile method.
There's any other way to load that XML data stored as text in the database exports table into a TCustomADODataset that don't need temporary files?
Notes:
- TClientDataset is not an option in this case.
回答1:
Check this example. It is probably exactly what you are looking for. Using the RecordsetFromXML
from that example you can simply assign the recordset to your TCustomADODataSet.Recordset
property.
来源:https://stackoverflow.com/questions/7812537/adodataset-how-to-load-xml-saved-beforehand-in-db-in-ado-schema-data-without