现在的位置: 首页 > 综合 > 正文

C#读取excel

2012年11月20日 ⁄ 综合 ⁄ 共 361字 ⁄ 字号 评论关闭

string strConn = "Provider=Microsoft.Jet.Oledb.4.0;Data Source=" + FilePath + ";Extended Properties='Excel 8.0;HDR=Yes;IMEX=1;'";
            OleDbConnection conn = new OleDbConnection(strConn);
            conn.Open();
            OleDbCommand comm = new OleDbCommand("SELECT*FROM[Sheet1$]", conn);
            OleDbDataReader myReader = comm.ExecuteReader(CommandBehavior.CloseConnection);

抱歉!评论已关闭.