delphidelphi-2010tadodataset

ADODataset: how to load XML (saved beforehand in DB in ADO schema) data without temporary files?


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:


Solution

  • 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.