Wade Ye

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: :: 管理 ::

//string strConnEXCEL = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\fileFolder;Extended Properties='TEXT;HDR=Yes;FMT=Delimited;'";

string relativePath = "/fileFolder";
string absolutePath = Server.MapPath(relativePath);


string strConnCSV = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + absolutePath +";Extended Properties='TEXT;HDR=Yes;FMT=Delimited;'";

            OleDbConnection objConn = new OleDbConnection(strConnCSV);
            string strSql = "select * from " + fileName;
            objConn.Open();
            OleDbDataAdapter odbcCSVDataAdapter = new OleDbDataAdapter(strSql, strConnCSV);
            mDataSet = new DataSet();
            odbcCSVDataAdapter.Fill(mDataSet);

           
            objConn.Close();

            grdMapping.DataSource = mDataSet ;
            grdMapping.DataBind();

posted on 2012-11-06 15:26  Wade_Ye  阅读(224)  评论(0编辑  收藏  举报