65.9K
CodeProject is changing. Read more.
Home

Create a blank Jet database

starIconstarIconstarIconstarIcon
emptyStarIcon
starIcon

4.67/5 (2 votes)

Nov 9, 2010

CPOL
viewsIcon

9673

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) { ...

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)
        {
            ADOX.CatalogClass cat = new ADOX.CatalogClass();
            cat.Create("Provider=Microsoft.Jet.OLEDB.4.0;" +
                   "Data Source=D:\\AccessDB\\NewMDB.mdb;" +
                   "Jet OLEDB:Engine Type=5");
            Console.WriteLine("Database Created Successfully");
            cat = null;
        }
    }
}
But many thanks for the embedded version - the trick just works for all esoterism file formats we need in our projects. And a special thanks :-O for the c style one line solution. That is a real 5 too.