C#でaccess2007 or 2010 のaccdbファイルを作成する手順です。
なかなかハマってしまったので、備忘録として残しておきます。
まず、ソリューションの参照設定で、COMタブのMicrosoft ADO Ext.6.0 for DLL and Security を追加します。
以下サンプルプログラムです。
using system;
using ADOX;
namespase TestNameSpase
{
public static class DBClass
{
public static void CreateAccdb()
{
ADOX.Catalog cat = new Catalog();
cat.Create("Provider=Microsoft.ACE.OLEDB.12.0;" +
@"Data Source=D:\test.accdb;" +
"Jet OLEDB:Engine Type=6");
cat = null;
}
}
}
参考サイト:https://support.microsoft.com/?scid=kb;ja;317881&spid=2988&sid=451
上記サイトは、Access 2000 (Jet 4.0) の古い形式です、
Access2010では、ProviderでACEエンジン(acecore.dll)を利用する為、
Providerの設定がJet.OLEDB から ACE.OLEDB に変わっています。
あと、OLEDB:Engine Typeが5から6に変わります。
Microsoft Office Access 2007 または Microsoft Access 2010 の仕組みについては下記が参考になりました。
参考サイト:https://msdn.microsoft.com/ja-jp/library/office/ff965871(v=office.14).aspx#DataProgrammingWithAccess2010_CSharpADONetExample