One way is using
Interop.Access
in
.NET framework
and another way is using
ADOX
library .
Here is the code which is extracted from here :
http://stackoverflow.com/questions/155848/how-do-i-create-a-microsoft-jet-access-database-without-an-interop-assembly[
^]
if (!File.Exists(DB_FILENAME))
{
var cnnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + DB_FILENAME;
var catType = Type.GetTypeFromProgID("ADOX.Catalog");
object o = Activator.CreateInstance(catType);
catType.InvokeMember("Create", BindingFlags.InvokeMethod, null, o, new object[] {cnnStr});
OleDbConnection cnn = new OleDbConnection(cnnStr);
cnn.Open();
var cmd = cnn.CreateCommand();
cmd.CommandText = "CREATE TABLE VideoPosition (filename TEXT , pos LONG)";
cmd.ExecuteNonQuery();
}
and if you don't want use ADOX read this article to get some clues :
http://support.microsoft.com/kb/317114[
^]
But generally speaking generating MDB files in runtime is somehow an immature approach...
Good Luck