求助:asp.net 导出 Excel
我这样写的:只能导出前二十条记录,不知道怎么回事.HttpResponse resp;
resp = Page.Response;
resp.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
resp.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(FileName, System.Text.Encoding.UTF8).ToString() + ".xls");
resp.ContentType = "application/ms-excel";
string ls_title, ls_item;
ls_title = string.Empty;
ls_item = string.Empty;
//定义表对象与行对像,同时用DataSet对其值进行初始化
DataTable dt = ds.Tables[0];
DataRow[] myRow = dt.Select("");
ls_title += "排序\t 帐号\t 姓名\t 职位\t性质\n ";
foreach (DataRow row in myRow)
{
ls_item += row["M_orderID"] + "\t" + row["M_userName"].ToString() + "\t" + row["M_realName"].ToString() + "\t" + Group.getGroupInfoById(row["M_department"].ToString(), "G_baseName") + "\t" + Group.getMemberTypeById(row["M_sign"].ToString(), "MT_typeName") + "\n";
}
resp.Write(ls_title + ls_item);
//写缓冲区中的数据到HTTP头文件中
resp.End();