How to create an Access DB with vba / c# (DBMS) -
i have seen tutorials trying not working.
i want simple project 1 textbox (where name of database goes) , button creates theaccess db , save in c:\.
may me ? :)
to create new, empty access database, need add com reference
"microsoft ado ext. 2.8 ddl , security"
to project, , use code following:
using system; using system.collections.generic; using system.linq; using system.text; namespace adoxtest { class program { static void main(string[] args) { string myconnectionstring = @"provider=microsoft.ace.oledb.12.0;data source=c:\__tmp\mydb.accdb;"; // following code requires com reference "microsoft ado ext. 2.8 ddl , security" var cat = new adox.catalog(); cat.create(myconnectionstring); // create new, empty .accdb file console.writeline("done."); } } } if want go "old school" , create .mdb file using jet, use following connection string instead...
string myconnectionstring = @"provider=microsoft.jet.oledb.4.0;data source=c:\__tmp\mydb.mdb;"; ...but warned fail if application running 64-bit (because there no 64-bit version of jet database engine).
Comments
Post a Comment