如何从存储过程获取数据到xls文件?

时间:2015-03-28 09:26:15

标签: c# sql-server stored-procedures

dgvEmployeeTimeSheet.DataSource  = OCommonFunctions.SelectData("sp_GP_EmployeeTimeSheetDetailSelectForXLS", "@fromdate", dtpFromDate.Value.ToString("MM/dd/yyyy"), "@todate", dtpTODate.Value.ToString("MM/dd/yyyy"), "@companyid", cmbCompany.SelectedValue.ToString());
来自上述程序的数据将被纳入

for (i = 0; i <= ds.Tables[0].Rows.Count - 1; i++)
       {
           for (j = 0; j <= ds.Tables[0].Columns.Count - 1; j++)
           {
               data = ds.Tables[0].Rows[i].ItemArray[j].ToString();
               xlWorkSheet.Cells[i + 1, j + 1] = data;
           }
       }

我该怎么办?

0 个答案:

没有答案