XML to a recordset
SharpGrid Support
XML to a recordset
11-02-2009, 9:10 PM
Hello DD,
I have saved a XML file with the option:
SGrid1.ExportData App.Path & "\solosec.xml", sgFormatXML, sgExportFieldNames + sgExportOverwrite, ","
It indeed saves an XML file, but I want to load that XML into a Recordset. How can I go about this?
Your help is appreciated.
Re: XML to a recordset
11-03-2009, 12:40 AM
solo_software,
There should be several ways to do this, for example I've found this KB article from Microsoft:
How To Obtain an ADO Recordset from XML:
http://support.microsoft.com/kb/263247
Thank you,
Andrey T.
Re: XML to a recordset
11-03-2009, 9:31 AM
Thanks Andrey,
However this does not work as MS says:
Err number: -2147467259
Err Description: No se puede crear el Recordset. El origen XML está incompleto o no es válido.
This translates that the XML document created by the SharpGrid is not a Valid one or is incomplete.
I took all the XML files provided on the Samples from DD and all failed except the one called countries.xml. Guess what that is the only XML file on the samples that is not created by DD, all others failed to load.
The files that failed have this header:
-
The one that pass has a complete different format.
Can you please help me to convert an XML file created by DD to a recordset?
Thanks.
Re: XML to a recordset
11-03-2009, 9:33 AM
This is the header on all the ones that failed:
Data Dynamics #Grid exported data
Generated at 2009-11-02 22:38
Copyright © 2000-2005 Data Dynamics
Re: XML to a recordset
11-03-2009, 10:43 AM
Well this is yet another limitation for DD Sharpgrid. I give up on the XML DD provides as they are useless outside SharpGrid (the method does not provide a true schema)
For those of you moving data. I will suggest to use the CSV way. Save the file as a sgFormatCharSeparatedValue with the ExportData Method and read it back with the ImportData method sgFormatCharSeparatedValue option.
Then that CSV file can be handled by a recordset. You can see how here:
http://www.freevbcode.com/ShowCode.Asp?ID=2180
good luck