Before throwing this code away, it can also work in stackoverflow
Something in these lines looks like a trick:
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();
}
This code shows that you can access the database using OleDbConnection after creating it using the ADOX.Catalog COM component.
source
share