Click here to Skip to main content
15,881,757 members
Articles / Programming Languages / C#

Create a blank Jet database

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
26 Nov 2010CPOL 5.1K   2  
This line:ADOX.CatalogClass cat = new ADOX.CatalogClass();may not work if you are using C# 4.0+You will needADOX.Catalog cat = new ADOX.Catalog();For a completed method checkout:http://zamirsblog.blogspot.com/2010/11/creating-access-database.html[^]

Alternatives

Members may post updates or alternatives to this current article in order to show different approaches or add new features.

Please Sign up or sign in to vote.
7 Nov 2010FZelle
You can do this in a much easier way:object ADOXCat = Activator.CreateInstance(Type.GetTypeFromProgID("ADOX.Catalog"));ADOXCat.GetType().InvokeMember("Create", System.Reflection.BindingFlags.InvokeMethod, null, ADOXCat, new string[] { ConnectionString });
Please Sign up or sign in to vote.
18 Nov 2010Diamonddrake
another way is to first create a empty db in access then read its bytes into an array and export them as a string. Then hardcode that string into a class that creates the the empty database by converting the hardcoded string back into a byte array and then writing it to disk as a mdb...
Please Sign up or sign in to vote.
23 Nov 2010ISanti
I like to use the old JET API to manipulate ACCESS Databases.In C# 4 all you need to create a blank JET database is add a reference to Microsoft.Office.Interop.Access.Dao library in your WINDOWS FORMS project, and two simple lines of code: var engine=new DBEngine(); var...
Please Sign up or sign in to vote.
13 Nov 2010snoopy001
And here is the long version, provided from Microsoft:http://support.microsoft.com/kb/317881/en-u[^]using System;using ADOX;namespace ConsoleApplication1{ class Class1 { [STAThread] static void Main(string[] args) { ...
Please Sign up or sign in to vote.
13 Nov 2010Dr.Walt Fair, PE 5 alternatives  
How to create a blank Jet database

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions