工程是一门科学,科学是严谨的。

读取csv文件

            String sConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\\test\\;Extended Properties='text;HDR=No;FMT=Delimited'";
            OleDbConnection objConn = new OleDbConnection(sConnectionString);
            objConn.Open();
            DataTable dt = new DataTable();
            OleDbCommand objCmdSelect = new OleDbCommand("SELECT * FROM test.csv", objConn);
            OleDbDataAdapter objAdapter1 = new OleDbDataAdapter();
            objAdapter1.SelectCommand = objCmdSelect;
            objAdapter1.Fill(dt);
            objConn.Close();

 

posted @ 2014-05-14 11:04  大圣的笑  阅读(307)  评论(0编辑  收藏  举报