25 December, 2008

Call the XML and pass in the Paramter into XML

SqlConnection sqlconn = new SqlConnection("Server=T-YOUNGF1\\SQLEXPRESS;Database=pubs;uid=sa;pwd=*");
SqlDataAdapter sda = new SqlDataAdapter();
SqlCommand sqlcmd = new SqlCommand("select * from test", sqlconn);
sda.SelectCommand = sqlcmd;
DataSet ds = new DataSet();
sda.Fill(ds, "test");
ds.WriteXml("c:/aa.xml");
XmlDocument xdoc = new XmlDocument();

xdoc.LoadXml(ds.GetXml());
xdoc.Save("c:/data11.xml");

No comments: