예제 #1
0
파일: PublicDB.cs 프로젝트: sloww/RTPrint
 public static bool TestDB(string connString)
 {
     bool r = false;
     using (var db = new  DB())
     {
         db.Database.Connection.ConnectionString = connString;
         try
         {
             db.Database.Connection.Open();
             r = (db.Database.Connection.State == ConnectionState.Open);
         }
         catch(Exception ee)
         {
             System.Windows.Forms.MessageBox.Show(ee.Message);
             r = false;
         }
     }
     return r;
 }
예제 #2
0
파일: PublicDB.cs 프로젝트: sloww/RTPrint
        public static DB getDB(int timeOut)
        {
            /*
            if (!System.IO.File.Exists("config.ini"))
            {
                FDatabase m = new FDatabase();
                m.ShowDialog();
            }*/

            var db = new DB();
            db.Database.Connection.ConnectionString = getIniConn("config.ini", timeOut);
            db.Configuration.EnsureTransactionsForFunctionsAndCommands = true;
            return db;
        }