【发布时间】:2016-04-12 11:42:38
【问题描述】:
我想将datatable 绑定到excel。我为此编写了以下代码
public void ExportExcel()
{
string str_lwpc_query = string.Empty;
str_lwpc_query = "select company_name 'COMPANY NAME',Deputed_Company_Name 'DEPUTED COMPANY NAME',emp_card_no 'EMP CODE',emp_name 'EMPLOYEE NAME',LWP,'' Remarks, " +
"Adj_Days Gain_Loss_LOP_Days, VAL_DAY LOP_Days_Desc, month, year from XXACL_EMP_INFO_LWP_OTDAYS_HRS_V " +
"where emp_type='C' and month = '3' and year = '2015'";
DataTable Dt_lwpc = new DataTable();
//DT_Overdue.TableName = "Daily Lead";
Dt_lwpc = CF.ExecuteDT(str_lwpc_query);
DataSet DS_lwpc = new DataSet();
DS_lwpc.Tables.Add(Dt_lwpc);
DS_lwpc.Tables[0].TableName = "Employee loss of pay for consultant Details";
ExcelLibrary.DataSetHelper.CreateWorkbook("~/Attachment/Employee_lwpc_Details.xls", DS_lwpc);
}
但我收到错误
找不到路径“C:\Program Files (x86)\Common Files\Microsoft Shared\DevServer\10.0\~\Attachment\Employee_lwpc_Details.xls”的一部分。
在最后一行。不知道为什么
【问题讨论】: