//导出数据到Excel
 protected void lBtnToExcel_Click(object sender, EventArgs e)
 {
     //获取数据并填充到数据表
     using (var da = new t_sample_orderTableAdapter())
     {
         //检测session中保存的查询条件
         object obj = Session["sample_order_mgr_where_content"];
         string str = string.Empty;
         if (obj != null && obj.ToString().Length > 0)
         {
             str = obj.ToString();
         }
         //获取前1万行数据
         var tab = da.GetPagedData(0, 10000, str, "order by [id] desc", false, false);
         //设置列标题
         string[] titleCol =
             ("序号,订单序号,首卡卡号,尾卡卡号,状态,良率,样板编号,pcs面积," +
             "客户名称,客户代码,订单编号,订单pcs总数,订单pcs总面积,仓存pcs数," +
             "下单日期,需求日期,生产日期,已出pcs数量,已出pcs面积,未出pcs数量,未出pcs面积," +
             "备注,录入员,录入时间,修改时间").Split(',');
         //设置表名称
         string titleTab = "样板订单清单";
         //临时文件名称
         string fileName = titleTab + DateTime.Now.ToString("yyMMddHHmmss") + ".xls";
         //执行导出数据到excel
         bool isSuccess = ydPublicMethod.DataTable2Excel(tab, titleCol, ref fileName, titleTab);
         //如果成功则跳转到指定页面
         if (isSuccess)
         {
             Response.Redirect(fileName);
             //停止加载后续内容
             Response.End();
         }
     }
 }
 //导出数据到Excel
 protected void lBtnToExcel_Click(object sender, EventArgs e)
 {
     //获取数据并填充到数据表
     using (var da = new t_sample_orderTableAdapter())
     {
         //检测session中保存的查询条件
         object obj = Session["sample_order_mgr_unfinished_where_content"];
         string str = string.Empty;
         if (obj != null && obj.ToString().Length > 0)
         {
             str = obj.ToString();
         }
         //获取前1万行数据
         var tab = da.GetPagedData(0, 10000, str, "order by [id] desc", true, false);
         //设置列标题
         string[] titleCol =
             ("序号,订单序号,首卡卡号,尾卡卡号,状况,良率,样板编号,pnl长,pnl宽,pnl面积,客户名称,客户料号," +
             "订单编号,订单pcs数,订单pcs面积,事业部,销售单号,特殊流程,SMT备注,FPC单价,SMT单价,FPC+SMT总价,工具费," +
             "批次号,规格,备品数量,覆盖膜,投料率,开料pnl数,开料pnl面积,pnl含pcs数," +
             "开料pcs数,仓存pcs数,落单日期,需求日期,生产日期,已交货pcs数,已交货pcs面积," +
             "欠交货pcs数,欠交货面积,备注,录入员,录入时间,修改时间").Split(',');
         //设置表名称
         string titleTab = "未完成样板订单清单";
         //临时文件名称
         string fileName = titleTab + DateTime.Now.ToString("yyMMddHHmmss") + ".xls";
         //执行导出数据到excel
         bool isSuccess = ydPublicMethod.DataTable2Excel(tab, titleCol, ref fileName, titleTab);
         //如果成功则跳转到指定页面
         if (isSuccess)
         {
             Response.Redirect(fileName);
             //停止加载后续内容
             Response.End();
         }
     }
 }