I need to create a XML files from a dataset or datable; foreach record in dataset I have to create one file, following my code:
SqlDataAdapter da = new SqlDataAdapter("select top 5 * from dbo.Log", con);
DataSet ds = new DataSet();
da.Fill(ds, "Log");
DataTable dt = new DataTable("Log");
da.Fill(dt);
foreach (DataRow row in dt.Rows)
{
row.Table.WriteXml("D:\\" + row["id"] + ".xml");
// some other code...
That create 5 XML files but inside there are all 5 records found in the dataset/datatable... I want only one record for every file! How can I do so? thanks