4

I want to create Ms access2007 file programatically from c# using Microsoft.ACE.OLEDB.12.0

1
  • It's nice to know what you want to do. A proper question would explain what it is you actually need help with, including what you've already tried that doesn't work, etc. Jan 13, 2011 at 2:33

1 Answer 1

4

Here is some example:

    using System;
    using ADOX;

    namespace ConsoleApplication1
    {
        class Class1
        {
            [STAThread]
            static void Main(string[] args)
            {
                ADOX.Catalog cat = new ADOX.Catalog();

                cat.Create("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\myFolder\myAccess2007file.accdb;");

                Console.WriteLine("Database Created Successfully");

                cat = null;

            }
        }
    }
4
  • Thanks for the answer Build I have already try it and i got the message: "Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done." My code : ADOX.CatalogClass cat = new ADOX.CatalogClass(); cat.Create("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=c:\Tmp.accdb;Persist Security Info=False;");
    – Wisam
    Jan 13, 2011 at 11:22
  • Oh yahhh I Resolve it cat.Create("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\myFolder\myAccess2007file.accdb;;Jet OLEDB:Engine Type=5;"); Thanks any way
    – Wisam
    Jan 13, 2011 at 11:58
  • Sorry for inconvinience, I also have made some changes to my code, so that it is work properly.
    – apros
    Jan 13, 2011 at 12:32
  • <Microsoft ADO Ext. 6.0 for DDL and Security> for ADOX Dec 17, 2020 at 1:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.