none
Doubt regarding creation of database in MS ACCESS and C# RRS feed

  • Question

  • Is there any way i can create a MS ACCESS Database dynamically by writing code in C# ? and start adding data in to it ??  I need this for my college project.
    • Moved by CoolDadTx Wednesday, February 10, 2016 3:43 PM Office related
    Wednesday, February 10, 2016 2:44 PM

Answers

  • Using the Access COM API you can but do you really need to?  You can always embed a default database file as a resource in your assembly (or even as a standalone file shipped with your code).

    Michael Taylor
    http://blogs.msmvps.com/p3net

    • Marked as answer by David_JunFeng Thursday, February 18, 2016 2:37 PM
    Wednesday, February 10, 2016 3:43 PM
  • >>>Is there any way i can create a MS ACCESS Database dynamically by writing code in C# ? and start adding data in to it ??  I need this for my college project.

    According to your description, you could create an Access database by using ADOX or Microsoft.Office.Interop.Access Primary Interop Assemblies (PIAs),

    string database = @"D:\Mine.accdb";
    Microsoft.Office.Interop.Access.Application app;
    app = new Microsoft.Office.Interop.Access.Application();
    app.NewCurrentDatabase(database,
                           Microsoft.Office.Interop.Access.AcNewDatabaseFormat.acNewDatabaseFormatUserDefault,
                           Type.Missing);

    For more information, click here to refer about How to create an Access database by using ADOX and Visual C# .NET

    then use ADO.Net's OLEDB Provider to create table and write data.

    For more information, click here to refer about Data Programming with Microsoft Access 2010

    • Marked as answer by David_JunFeng Thursday, February 18, 2016 2:37 PM
    Friday, February 12, 2016 7:37 AM

All replies

  • Using the Access COM API you can but do you really need to?  You can always embed a default database file as a resource in your assembly (or even as a standalone file shipped with your code).

    Michael Taylor
    http://blogs.msmvps.com/p3net

    • Marked as answer by David_JunFeng Thursday, February 18, 2016 2:37 PM
    Wednesday, February 10, 2016 3:43 PM
  • I suggest you Google it. I was able to find several useful links within 5 minutes.
    Wednesday, February 10, 2016 8:00 PM
  • >>>Is there any way i can create a MS ACCESS Database dynamically by writing code in C# ? and start adding data in to it ??  I need this for my college project.

    According to your description, you could create an Access database by using ADOX or Microsoft.Office.Interop.Access Primary Interop Assemblies (PIAs),

    string database = @"D:\Mine.accdb";
    Microsoft.Office.Interop.Access.Application app;
    app = new Microsoft.Office.Interop.Access.Application();
    app.NewCurrentDatabase(database,
                           Microsoft.Office.Interop.Access.AcNewDatabaseFormat.acNewDatabaseFormatUserDefault,
                           Type.Missing);

    For more information, click here to refer about How to create an Access database by using ADOX and Visual C# .NET

    then use ADO.Net's OLEDB Provider to create table and write data.

    For more information, click here to refer about Data Programming with Microsoft Access 2010

    • Marked as answer by David_JunFeng Thursday, February 18, 2016 2:37 PM
    Friday, February 12, 2016 7:37 AM