Example #1
0
        public MainDBClass()
        {
            sqliteProvider = new DB_Class_SQLite.DBClassSQLite();

            string        conString     = string.Empty;
            int           bUseSQlServer = 0;
            DBClassSQLite db1           = new DBClassSQLite();

            db1.OpenDB();
            if (db1.isTableExist("tb_SqlServer_Info"))
            {
                db1.getSqlServerInfo(out conString, out bUseSQlServer);
            }
            db1.CloseDB();

            if ((bUseSQlServer == 1) && (!string.IsNullOrEmpty(conString)))
            {
                useDb             = dbUsedType.db_SqlServer;
                sqlServerProvider = new DBClassSqlServer.DBSqlServer(DBClass_SQLServer.UtilSqlServer.ConvertConnectionString(conString));
                try
                {
                    OpenDB();
                    CloseDB();
                }
                catch
                {
                    useDb = dbUsedType.db_SqlLite;
                    ErrorMessage.ExceptionMessageBox.Show("Unable to connect to SQL Server Database - Application start with local database to check configuration", "Information");
                }
            }
        }
Example #2
0
        private void toolStripButtonQuit_Click(object sender, EventArgs e)
        {
            _db.CloseDB();

            if (_bChange)
            {
                MessageBox.Show(ResStrings.str_Application_will_restart_to_take_into_account_column_change, ResStrings.DbSqlForm_toolStripButtonQuit_Click__Database_Info, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                Environment.ExitCode = 2; //the surrounding AppStarter must look for this to restart the app.
                Application.Exit();
            }
            else
            {
                Close();
            }
        }