Click here to Skip to main content
15,885,366 members
Articles / Programming Languages / C#

Create a blank Jet database

Rate me:
Please Sign up or sign in to vote.
4.50/5 (8 votes)
13 Nov 2010CPOL1 min read 35.9K   9  
How to create a blank Jet database

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.
26 Nov 2010ZamirF
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[^]

License

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


Written By
Engineer Comport Computing
United States United States
I am a software developer specializing in technical and numerical software systems and also a PhD Petroleum Engineer.
I started programming in IBM 1620 machine code in 1967, then FORTAN on CDC mainframes mainframes in 1970. I later used ALGOL, BASIC, FORTH, Pascal,Prolog, C, F#, C#, etc.
I generally use whatever language available thatallows me to accomplish what is neccesary.

Comments and Discussions