예제 #1
0
 private void button_CheckDBversion_Click(object sender, EventArgs e)
 {
     try
     {
         _oleDb = new OleDb();
         _oleDb.Open();
         _oleDb.CreateDbCommand("SELECT TOP(1)* FROM [DbVersion] ORDER BY ID DESC");
         _oleDb.ExecuteReader();
         _oleDb.Reader.Read();
         button_CheckDBversion.Text = Convert.ToString(_oleDb.Reader["Build"]);
         _oleDb.Close();
     }
     catch (Exception exception)
     {
         button_CheckDBversion.Text           = @"Ошибка";
         _mainForm.toolStripStatusLabel1.Text = @"Ошибка чтения версии базы " + exception.Message;
         if (_oleDb != null)
         {
             _mainForm.toolStripStatusLabel1.Text += @" SQL: " + _oleDb.MessErr;
         }
     }
     finally
     {
         if (_oleDb != null && _oleDb.SqlConnected())
         {
             _oleDb.Close();
         }
     }
 }