Wednesday, August 21, 2013

SQL data to XML

SQL data to XML

i want save data from sql database to xml. I have this code:
SqlConnection con = new SqlConnection("Data Source=*****;Persist Security
Info=True;User ID=****;Password=*******;");
string strSQL = "Select * from DATABAZE WHERE (KOD_ZBOZI
='1047')";
SqlDataAdapter dt = new SqlDataAdapter(strSQL, con);
DataSet ds = new DataSet();
dt.Fill(ds, "DATABAZE");
ds.WriteXml(Server.MapPath("C:\\Users\\Lukas\\Desktop\\NOHEL.xml"));
But i have this error:
The name 'Server' does not exist in the current context
Have you any idea?

No comments:

Post a Comment