批量上传c#设置excel文件的表格

时间:2017-05-22 04:28:22

标签: c# bulkupdate

如何定义要上传的excel文件表? 这是我的示例代码。

string Sheet_1 = Excel_Con
      .GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null)
      .Rows[0]["TABLE_NAME"]
      .ToString();

using (OleDbDataAdapter oda = new OleDbDataAdapter
      ("SELECT [Question_No] AS Question_No, " + 
       "[Question_Description] AS Question_Description, " + 
       "[Is_Option] AS Is_Option, " +
       "FROM [" + Sheet_1 + "]" +
       "WHERE Question_Description IS NOT NULL"
       , Excel_Con))   
{
    oda.Fill(ExcelData);
}

0 个答案:

没有答案