如上

解决方案 »

  1.   

    string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + "文件路径" + ";" + "Extended Properties=Excel 8.0;";
                OleDbConnection conn = new OleDbConnection(strConn);
                conn.Open();
                OleDbDataAdapter myCommand = null;
                DataSet ds = null;
                string strExcel = "select * from [" + "sheet名称"+ "$]";
                myCommand = new OleDbDataAdapter(strExcel, strConn);
                ds = new DataSet();
                myCommand.Fill(ds, sheetname);
                conn.Close();
                return ds; 
    把查询到的记录更新到数据库