asp.net导出EXCEL问题! - .NET技术 / ASP.NET
C# code:
SqlConnection conn = CsDB.sqlcon();
SqlDataAdapter da = new SqlDataAdapter("select fwCoding from bjmuma_fwCoding where OrderNumber='" + Order + "'", conn);
DataSet ds = new DataSet();
da.Fill(ds, "table1");
DataTable dt = ds.Tables["table1"];
StringWriter sw = new StringWriter();
sw.WriteLine("test", "vnd.ms-excel.numberformat:@");
foreach (DataRow dr in dt.Rows)
{
sw.WriteLine(dr["fwCoding"]);
}
//string execlname = CsDB.GetSear(Coding);
sw.Close();
// foreach (DataGridItem dg in this.DataGrid1.Items) { dg.Cells[列].Attributes.Add("style", "vnd.ms-excel.numberformat: @;"); } this.DataGrid1.RenderControl(hw);
//DateTime.Now.ToString("yyyyMMdd_hhmm")
Response.AddHeader("Content-Disposition", "attachment; filename=" + CsDB.GetSear(Order) + ".csv");
Response.ContentType = "application/ms-excel";
Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
Respons
相关问答:
http://www.zgjhjy.com/Test/PrimaryTest/Index.aspx
就是类似以上的在线测试系统,需要有一个后台的,语言是asp的,数据库是access的,还需要能在后台对信息进行添删改查的。谢谢各位了。。。
程序真的很多,不知 ......
我想打印数据库里面读取出来的多条数据内容,实现批量打印
先导入excel或者word,然后在打印
或者购买web打印控件
使用acitvex打印。如果不需要选择属性,设置属性,就不需要商业的了。
<style media= ......
asp虚拟主机实现伪静态的方法:
1、 重写url参数
Step1: 建立前台文件index.asp,修改url参数形式。由于读取数据库中的记录不是专题的重点,故直接给出:
<!--#include file="config.asp" -->
&l ......