建不同的DataSet。。。。
如:
下面为DataGrid导出Excel(可以根据自己需要改哈就OK拉)
#region 导出到Excel
Response.Clear();
Response.Buffer = false;
Response.Charset = "GB2312";
Response.AppendHeader("Content-Disposition", "attachment;filename=test.xls");
Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312"); Response.ContentType = "application/ms-excel"; this.EnableViewState = false;
System.IO.StringWriter oStringWriter = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
dgToExecl.RenderControl(oHtmlTextWriter); //dgTOExcel 为datagrid
Response.Write(oStringWriter.ToString());
Response.End();
#endregion