I'm working on a product feature that will allow the user to export data from a SQL CE database on one copy of my application and re-import it into SQL CE on the other end. This data is not whole tables, but the result of queries.
I had hoped to take advantage of .net's built-in XML-based serialization like in DataTable.WriteXML. But, none of the methods for executing queries against a SqlCeCommand provide an obvious way of serializing to XML or extracting a DataTable, which could provide the method.
Is there something I'm missing? Do I have to write my own serialization-deserialization methods or is there a built-in way.
Assuming cmd is your SqlCeCommand....
using(var dr = cmd.ExecuteReader())
{
DataSet ds = new DataSet();
DataTable dt = ds.Tables.Add();
dt.Load(dr);
ds.WriteXML(...);
}