No data for Export DataSet to EXCEL
Hi,
I just can export table structure to excel. No data found. Pls help.
here is my code :
......
this.sqlDataAdapter.Fill(this.dsTables, "testTable");
DataGrid dg = new DataGrid();
dg.DataSource = this.dsTables.Tables["testTable"];
dg.DataBind();
Response.ContentType = "application/vnd.ms-excel";
Response.Charset = "";
this.enableViewState = false;
System.IO.StringWriter tw = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter hw = new HtmlTextWriter(tw);
dg.RenderControl(hw);
Response.Write(tw.ToString());
Response.End();
Thanks
Wilson