Exemple #1
0
        private DbConnection CreateConnection()
        {
            DbConnection conn = m_conn.CreateSystemConnection();

            conn.ConnectionString = m_conn.GenerateConnectionString(true);
            return(conn);
        }
Exemple #2
0
        private void btok_Click(object sender, EventArgs e)
        {
            m_frame.SaveConnection();
            m_common.SaveConnection();

            try
            {
                DbConnection conn = m_conn.CreateSystemConnection();
                try
                {
                    Async.InvokeFromGui(conn.Open);
                    Async.InvokeFromGui(conn.Close);
                }
                catch (Exception err)
                {
                    throw new ConnectionFailedError("DAE-00162", err);
                }
                DialogResult = DialogResult.OK;
                Close();
            }
            catch (Exception err)
            {
                Errors.Report(err);
                return;
            }

            DialogResult = DialogResult.OK;
            Close();
        }
Exemple #3
0
 public static void DropDbs()
 {
     foreach (var con in Config.Instance.Connections)
     {
         string            fn = Path.Combine(Config.Instance.AppDataDirectory, "data/" + con.ConFileName);
         IStoredConnection sc = StoredConnection.LoadFromFile(fn);
         if (sc == null)
         {
             TestLog.Info("Cannot connect to database " + con.ConFileName);
             continue;
         }
         using (DbConnection dbconn = sc.CreateSystemConnection())
         {
             dbconn.Open();
             try
             {
                 TestLog.Info("Deleting testing database");
                 dbconn.ExecuteNonQuery("DROP DATABASE testingdb", new GenericDialect());
             }
             catch (Exception e)
             {
                 TestLog.Error("Error creating database", e);
             }
         }
     }
 }