????Access?????????????
???????а???? ???????[ 2016/8/17 10:24:11 ] ????????????? Access
??????????????????Y?????????Sqlite??SQL Server Express??SQL Local DB??SQL Server CE??Access?????????????????Access?????????????????????????????????顣
????Access???????Office?????????????????????λ?????????????????Щ??????????????????????????????????????
????????ж??????????Provider??????
?????????????Access???????????????OLEDB??Microsoft.Jet.OLEDB.4.0???????????????и?????????????????????????????
??????jet.oledb?????32λ????????ó???????x64?汾????????????????????
??????????x86???????????С????????????????????Any CPU????????????У??????
??????????????????????????л???“????”???????Any CPU????У????????????????“32λ”????????????“32λ”??????????????????
???????????64λ???????У????????????????????“32λ”??????????
???????????仯??У?Access?汾??????£???2007??.mdb????????.accdb?????????????Jet.OLEDB?????????????.mdb??????
????????.accdb????????????Microsoft.ACE.OLEDB.12.0????????????????????д??
????Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\students.accdb
?????й?????????????????????????????????http://www.connectionstrings.com/
??????????????????????????????????????????????????????????
??????????????Microsoft.ACE.OLEDB.12.0??????????????????????? https://www.microsoft.com/zh-cn/download/details.aspx?id=13255
??????????.accdb??????????????汾????????????????32λ?????ó???????????x86?汾????????????????64λ?????????????ó????????x64?汾??
?????д???????????????????????а??ж?????????????????????????У???????????????????????????????????????????????
??????????
????OleDbDataReader reader = OleDbEnumerator.GetRootEnumerator();
????DataTable table = new DataTable();
????table.Load(reader);
????dataGridView1.DataSource = table.DefaultView;
???????????????????
????OleDbEnumerator enumerator = new OleDbEnumerator();
????DataTable dt = enumerator.GetElements();
????dataGridView1.DataSource = dt.DefaultView;
???????????????????????OLEDB?????????г?????????????
???????У?SOURCES_NAME??????????????????????????????У??????????????????????????????????????а?????????????
???????磬????????????μ?????л?????????????.accdb?????
????string accdbPrd = "Microsoft.ACE.OLEDB.12.0";
????OleDbEnumerator enu = new OleDbEnumerator();
????DataTable dtprd = enu.GetElements();
????// Linq
????var qr = from r in dtprd.AsEnumerable()
????where r.Field<string>("SOURCES_NAME") == accdbPrd
????select r;
????if (qr.Count() == 0)
????MessageBox.Show("????????????????????");
????else
????MessageBox.Show("????????????????");
???????????????.accdb???
?????????????????????????????????е?Provider???Microsoft.ACE.OLEDB.12.0???????????ο??????????????????????????????????????
????????????|DataDirectory|?λ??
????Data Source?????????????????·???????????????????д??Data Source= |datadirectory|\mydb.accdb??DataDirectory?λ??????????Сд???????????£?????Web?????datadirectory?????????μ?App_Data??????ASP.NET???????????????????????????????????datadirectory?????ó??????е????????????????indebug???????У????????????indebug??
???????????datadirectory???????????????????????????????????????“???”????
????string docpath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
????AppDomain.CurrentDomain.SetData("DataDirectory"?? docpath);
????????AppDomain??SetData???????????|datadirectory|?λ???????????????????????.accdb???????????????μ?“???”?£???C:Users<my name>Documents??
?????????????????????????д??
????Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\pigstore.accdb
??????????????·?????C:Users<my name> Documentspigstore.accdb??
??????????????????????????????????????????????????д????????????????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11