public DataSet DetailReadExcel(string Path)
{
string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" +"Data Source="+ Path +";"+"Extended Properties=Excel 8.0;";
OleDbConnection conn = new OleDbConnection(strConn);
conn.Open();
Console.WriteLine(conn.State);
string strExcel = "";
OleDbDataAdapter myCommand = null;
DataSet ds = null;
strExcel="select * from [定档数据汇总-263人$]";
myCommand = new OleDbDataAdapter(strExcel, strConn);
ds = new DataSet();
myCommand.Fill(ds,"table1");
return ds;
} ds.Tables[0].Rows[i+3][118] 中有个字段为空??
{
string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" +"Data Source="+ Path +";"+"Extended Properties=Excel 8.0;";
OleDbConnection conn = new OleDbConnection(strConn);
conn.Open();
Console.WriteLine(conn.State);
string strExcel = "";
OleDbDataAdapter myCommand = null;
DataSet ds = null;
strExcel="select * from [定档数据汇总-263人$]";
myCommand = new OleDbDataAdapter(strExcel, strConn);
ds = new DataSet();
myCommand.Fill(ds,"table1");
return ds;
} ds.Tables[0].Rows[i+3][118] 中有个字段为空??
"Data Source=" + FileName + ";" +
"Extended Properties=\"Excel 8.0;HDR=No;IMEX=1\"";
IMEX=1 表示混合字段