Create MS MDB without MS Access

(from http://www.eggheadcafe.com/PrintSearchContent.asp?LINKID=1089)

//Set a COM Reference to “Microsoft ADO Extensions for DDL and Security” (ADOX)

private ADOX.Catalog cat = new ADOX.Catalog();
private ADOX.Table tbl = new ADOX.Table();
private string db_file_path;
db_file_path = ActiveWorkbook.Path + “\\abc.mdb”;
//connect to the Access database
cat.ActiveConnection = “Provider=Microsoft.Jet.OLEDB.4.0;” + “Data Source=” + db_file_path;

//Create a table
tbl.Name = “Prospects”;
// First, fields are appended to the table object
// Then the table object is appended to the Tables collection
tbl.Columns.Append “Name”, adVarWChar;
tbl.Columns.Append “Company”, adVarWChar;

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s