// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; using System.Data; using System.Data.OleDb; namespace E { public class DB { private string constr; public DB(string dbfile) { constr = string.Format("Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};User Id=admin;Password=;", dbfile); } public void DoSomething() { using(OleDbConnection con = new OleDbConnection(constr)) { con.Open(); // ... } } } public class DBX : DB { public DBX() : base(@"C:\Work\Database11.accdb") { } public void DoMore() { DoSomething(); // ... } } public class Program { public static void Main(string[] args) { DBX o = new DBX(); o.DoMore(); } } }