using System;
using System.Data;
using System.Data.SqlClient;
public class SaveDataSet
{
private static string connectionString = "Data Source=localhost;Initial Catalog=Northwind;Integrated Security=SSPI";
public static void Main()
{
string SQL = "SELECT CategoryID, CategoryName,Description FROM Categories";
SqlConnection con = new SqlConnection(connectionString);
SqlCommand com = new SqlCommand(SQL, con);
SqlDataAdapter adapter = new SqlDataAdapter(com);
DataSet ds = new DataSet("Nortwind");
con.Open();
adapter.FillSchema(ds, SchemaType.Mapped, "Categories");
adapter.Fill(ds, "Categories");
con.Close();
ds.WriteXmlSchema("mydata.xsd");
ds.WriteXml("mydata.xml");
ds.Reset();
ds.ReadXmlSchema("mydata.xsd");
ds.ReadXml("mydata.xml");
Console.WriteLine(ds.GetXml());
}
}