Using the method described in Microsofts Knowledge Base article
http://support.microsoft.com/default...b;en-us;316337
to convert an XML file created by a DataSet into an XML file read by
ADO.
This seems pretty straight forward and the ADO recordset *opens*
without error, however it's quite empty. Any attempt to use it (e.g.
MoveFirst or RecordCount) causes an E_FAIL error. The translated XML
file has lots of data when viewed with a browser.
The code is below...
DataSet ds = new DataSet();
try
{
SqlDataAdapter da = new SqlDataAdapter("SELECT * FROM MyTable",
SqlConn);
da.Fill(ds, "MyTable");
da.FillSchema(ds.Tables["MyTable"], SchemaType.Source);
ConvertDStoRS.ConvertToRs converter = new
ConvertDStoRS.ConvertToRs();
long res = converter.GetADORS(ds, "MyDB", "DC.XSL", DC.XML");
if (res == 1)
{
ADODB.Recordset rs = new ADODB.RecordsetClass();
rs.Open(path + @"\DriveCam.XML", Type.Missing,
ADODB.CursorTypeEnum.adOpenStatic,ADODB.LockTypeEn um.adLockOptimistic,
-1);
int rcnt = rs.RecordCount;
}
}
catch (Exception ex) {}
Thanks in advance.