Exemple #1
0
 /// <summary>
 /// Инициализировать базу данных
 /// </summary>
 /// <param name="password">пароль - ввести qqq</param>
 public void InitDataBase(string password)
 {
     if (password == "qqq")
     {
         DBI sqlDB = new SQLDB(connectionString);
         try
         {
             sqlDB.OpenConnection();
             sqlDB.OpenTransaction();
             sqlDB.DataBaseInit();
             sqlDB.CommitConnection();
         }
         catch (Exception ex)
         {
             sqlDB.RollbackConnection();
             Console.WriteLine(ex.Message);
         }
         finally
         {
             sqlDB.CloseConnection();
         }
     }
 }
Exemple #2
0
        public int DeleteDataBlockAndRecords()
        {
            SQLDB sqlDB = new SQLDB(connectionString);
            int deletedCount = 3;
            try
            {
                sqlDB.OpenConnection();
                sqlDB.OpenTransaction();

                // deletedCount = dataRecord.DeleteAllData(sqlDB);
                sqlDB.DeleteAllDataRecordsFast(DATA_BLOCK_ID);
                sqlDB.DeleteDataBlock(DATA_BLOCK_ID);

                sqlDB.CommitConnection();
                sqlDB.CloseConnection();
            }
            catch (Exception ex)
            {
                sqlDB.RollbackConnection();
                sqlDB.CloseConnection();
                throw ex;
            }
            return deletedCount + 1;
        }