码迷,mamicode.com
首页 > Windows程序 > 详细

c#读取excel

时间:2015-11-02 17:28:17      阅读:186      评论:0      收藏:0      [点我收藏+]

标签:

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();

c#读取excel

标签:

原文地址:http://www.cnblogs.com/xwchengc/p/4930310.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!