wilsonwu

wilsonwu

  • NA
  • 7
  • 0

No data for Export DataSet to EXCEL

Jun 28 2004 4:05 AM
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