string file = @"E:Tra.xls";
OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + file + ";Extended Properties=Excel 8.0");
conn.Open();
Console.WriteLine("连接成功");
OleDbCommand comm = new OleDbCommand("Select * from [Sheet1$]", conn);
OleDbDataReader re = null;
re = comm.ExecuteReader();
while (re.Read())
{
}
conn.close();