110,539
社区成员
发帖
与我相关
我的任务
分享
ExcelConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Scource='C:\Users\xxglding\Desktop\数据接收模板.xlsx';Extended Properties='Excel 12.0'";
DataTable table;
using (OleDbConnection OleDbConn = new OleDbConnection(ExcelConnectionString))
{
Console.Write("Coming");
string CommandText = "select * from [sheet1$]";
OleDbCommand OleDbComm = new OleDbCommand(CommandText, OleDbConn);
OleDbDataAdapter OleDbAdapter = new OleDbDataAdapter(OleDbComm);
DataSet ds = new DataSet();
OleDbConn.Open();
OleDbAdapter.Fill(ds, "Shot");
table = ds.Tables["Shot"];
}