首页 > 代码库 > ado ole方式访问access的两种方式

ado ole方式访问access的两种方式

            OleDbConnection Connection = new OleDbConnection();
            OleDbDataAdapter adapter = null;
            //ConnectiongString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
            //   + Path + ";Extended Properties=‘Excel 8.0;HDR=no;IMEX=0‘";
            ConnectiongString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source="
            + Path + ";Persist Security Info=False";
            Connection.ConnectionString = ConnectiongString;
            Connection.Open();
            //adapter = new OleDbDataAdapter("SELECT * FROM [MAP仓库库存$] ",
            //                            Connection);
            adapter = new OleDbDataAdapter("SELECT * FROM SunData ",
                                      Connection);
            dtTable = new DataTable();
            DataSet DataSet1 = new DataSet();
            adapter.Fill(DataSet1);
            dtTable = DataSet1.Tables[0];

 

ado ole方式访问access的两种方式