直接在调用的地方设置
// access 2003
DBConStr = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" + AppPath + "sample.mdb"; // access 2007 DBConStr = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=" + AppDomain.CurrentDomain.BaseDirectory + "Sample.accdb"; Driver ={ Microsoft Access Driver(*.mdb, *.accdb)}; DBQ = path to mdb/ accdb file” // mssql DBConStr = "Provider = SQLOLEDB.1;Data Source = 192.168.3.251;Initial Catalog = Sample;User ID = sa; Password = 1";