First, you muss add Microsoft ADO Ext. 6.0 (or whatever version you have) for DDL and Security as a reference.
stringfileName = "YourDatabaseFilename";
ADOX.Catalog cat = new ADOX.Catalog();
ADOX.Table table = new ADOX.Table();
try
{
cat.Create("Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + fileName + ".accdb; Jet OLEDB:Engine Type=5");
}
catch (Exception ex)
{
//For Windows Forms Applications
//MessageBox.Show("Database file is not created.");
//MessageBox.Show("Database file is not created.");
//For Console Applications
// Console.WriteLine("Database file is not created.");
}
cat = null;
Pages you may also want to visit:
Creating a Microsoft Access Database File
Adding a Table on a Microsoft Access Database File (with primary key)
Pages you may also want to visit:
Creating a Microsoft Access Database File
Adding a Table on a Microsoft Access Database File (with primary key)
No comments:
Post a Comment