Benutzer-Werkzeuge

Webseiten-Werkzeuge


windows:programming:net:mdb_adox_datenbankdatei_erstellen

MDB ADOX Datenbankdatei erstellen

public static void createDatabaseFile( string file ){
 
file = file.ToLower();
    if (!file.EndsWith(".mdb"))
    {
    file += ".mdb";
    }
    if (System.IO.File.Exists(file))
    {
        if (!overwrite)
        {
            return false;
        }
        System.IO.File.Delete(file);
    }
 
    ADOX.Catalog catalog = new ADOX.Catalog();
    string provider = "Provider=Microsoft.Jet.OLEDB.4.0;";
    string engine = "Jet OLEDB:Engine Type=5;";
    string datasource = "Data Source=" + file + ";";
    string jetDB = "Jet OLEDB:Encrypt Database=True;";
    string jetPwd = "Jet OLEDB:Database Password=MeinPasswort;";
    string conString = provider + engine + datasource + jetDB + jetPwd;
 
    object comObject = catalog.Create( conString );
    Marshal.ReleaseComObject( comObject );
    comObject = null;
    catalog = null;
    return true;
 
}
windows/programming/net/mdb_adox_datenbankdatei_erstellen.txt · Zuletzt geändert: 2014/10/20 11:01 von raiser