1DataSet ds = new DataSet();
2 SqlConnection cn = new SqlConnection("server=(local);database=Northwind;user id=sa;password=;");
3 SqlCommand cmd = new SqlCommand("Select * from customers;Select * from employees",cn) ;
4 cn.Open();
5 SqlDataAdapter da = new SqlDataAdapter(cmd);
6 da.Fill(ds);
7 ds.WriteXml(Server.MapPath("Customers.xml")) ;
8
9
10 ds.ReadXml(Server.MapPath("Customers.xml"));
11 string xml = WorkbookEngine.CreateWorkbook(ds);
12 Response.ContentType = "application/vnd.ms-excel";
13 Response.Charset = "";
14 Response.Write(xml);
15 Response.Flush();
16 Response.End();
17