<p>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.</p>

<p>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.</p>

<p>Is there something I'm missing? Do I have to write my own serialization-deserialization methods or is there a built-in way.</p>

[{'answer_id': 75651, 'author': 'Grank', 'author_id': 12975, 'author_profile': 'https://Stackoverflow.com/users/12975', 'pm_score': 0, 'selected': False, 'text': '<p>I would think you could retrieve the data to a DataSet, call WriteXML on it, and then on the other end declare a new DataSet and call ReadXML on it.</p>\n'}, {'answer_id': 75681, 'author': 'Joel Coehoorn', 'author_id': 3043, 'author_profile': 'https://Stackoverflow.com/users/3043', 'pm_score': 1, 'selected': False, 'text': "<p>You want to create an <code>SqlCeDataAdapter</code> and use it <code>.Fill()</code> a dataset.  Then serialize the entire dataset via it's <code>.WriteXml()</code> method.</p>\n"}, {'answer_id': 75702, 'author': 'Jonathan Rupp', 'author_id': 12502, 'author_profile': 'https://Stackoverflow.com/users/12502', 'pm_score': 3, 'selected': True, 'text': '<p>Assuming cmd is your SqlCeCommand....</p>\n\n<pre><code>using(var dr = cmd.ExecuteReader())\n{\n   DataSet ds = new DataSet();\n   DataTable dt = ds.Tables.Add();\n   dt.Load(dr);\n   ds.WriteXML(...);\n}\n</code></pre>\n'}]
['https://Stackoverflow.com/questions/75608', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5287/']