/[AnywhereTS-MSSQL]/trunk/TSAdminTool/Database.cs
ViewVC logotype

Diff of /trunk/TSAdminTool/Database.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 45 by william, Thu Jul 12 13:01:44 2012 UTC revision 51 by william, Thu Jul 12 16:21:35 2012 UTC
# Line 204  namespace AnywhereTS Line 204  namespace AnywhereTS
204                  }                  }
205              }              }
206              catch (SqlException sql_ex)              catch (SqlException sql_ex)
207              {              {              
208                  MessageBox.Show(sql_ex.Number.ToString() + " " + sql_ex.Message.ToString());                  MessageBox.Show(sql_ex.Number.ToString() + " " + sql_ex.Message.ToString());
209                    using (log4net.NDC.Push(string.Format("SqlException: ID={0} MESSAGE={1}{2}Diagnostics:{2}{3}", sql_ex.Number.ToString(), sql_ex.Message, System.Environment.NewLine, sql_ex.ToString())))
210                    {
211                        Logging.ATSAdminLog.Error("Failed to RunScript");
212                    }
213                  return false;                  return false;
214              }              }
215    
# Line 263  namespace AnywhereTS Line 267  namespace AnywhereTS
267                  {                  {
268                      using (log4net.NDC.Push(string.Format("SQL Statment={0}", "SELECT value from AnywhereTS..AppInfo where property='version'")))                      using (log4net.NDC.Push(string.Format("SQL Statment={0}", "SELECT value from AnywhereTS..AppInfo where property='version'")))
269                      {                      {
270                          Logging.ATSAdminLog.Debug("Gettting AnywhereTS Database Version");                          Logging.ATSAdminLog.Debug("Getting AnywhereTS Database Version#1");
271                          sqlCon = new SqlConnection(Properties.Settings.Default.atsConnectionString);                          sqlCon = new SqlConnection(Properties.Settings.Default.atsConnectionString.Replace("AnywhereTS", "master"));
272                          if (sqlCon.State != ConnectionState.Open) sqlCon.Open();                          if (sqlCon.State != ConnectionState.Open) sqlCon.Open();
273                          sqlCmd = new SqlCommand("SELECT value from AnywhereTS..AppInfo where property='version'", sqlCon);                          sqlCmd = new SqlCommand("SELECT value from AnywhereTS..AppInfo where property='version'", sqlCon);
274                          strResult = (string)sqlCmd.ExecuteScalar();                          strResult = (string)sqlCmd.ExecuteScalar();
# Line 294  namespace AnywhereTS Line 298  namespace AnywhereTS
298    
299                          using (log4net.NDC.Push(string.Format("SQL Statment={0}", "SELECT value from AnywhereTS..AppInfo where property='version'")))                          using (log4net.NDC.Push(string.Format("SQL Statment={0}", "SELECT value from AnywhereTS..AppInfo where property='version'")))
300                          {                          {
301                              Logging.ATSAdminLog.Debug("Gettting AnywhereTS Database Version");                              Logging.ATSAdminLog.Debug("Getting AnywhereTS Database Version#2");
302                              sqlCon = new SqlConnection(Properties.Settings.Default.atsConnectionString);                              sqlCon = new SqlConnection(Properties.Settings.Default.atsConnectionString.Replace("AnywhereTS", "master"));
303                              if (sqlCon.State != ConnectionState.Open) sqlCon.Open();                              if (sqlCon.State != ConnectionState.Open) sqlCon.Open();
304                              sqlCmd = new SqlCommand("SELECT value from AnywhereTS..AppInfo where property='version'", sqlCon);                              sqlCmd = new SqlCommand("SELECT value from AnywhereTS..AppInfo where property='version'", sqlCon);
305                              strResult = (string)sqlCmd.ExecuteScalar();                              strResult = (string)sqlCmd.ExecuteScalar();
# Line 366  namespace AnywhereTS Line 370  namespace AnywhereTS
370              catch (Exception e)              catch (Exception e)
371              {              {
372                  MessageBox.Show("Cannot set access rights for users to the database. Do you have the sufficient rights? Application will abort. Error: " + e.Message);                  MessageBox.Show("Cannot set access rights for users to the database. Do you have the sufficient rights? Application will abort. Error: " + e.Message);
373                    using (log4net.NDC.Push(string.Format("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", e.Message, System.Environment.NewLine, e.ToString())))
374                    {
375                        Logging.ATSAdminLog.Fatal("Cannot set access rights for users to the database.");
376                    }
377                  Application.Exit();                  Application.Exit();
378                  return;                  return;
379              }              }
# Line 387  namespace AnywhereTS Line 395  namespace AnywhereTS
395              catch (Exception e)              catch (Exception e)
396              {              {
397                  MessageBox.Show("Could not start the SQL Browser service (13078). Error:" + e.Message);                  MessageBox.Show("Could not start the SQL Browser service (13078). Error:" + e.Message);
398                    using (log4net.NDC.Push(string.Format("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", e.Message, System.Environment.NewLine, e.ToString())))
399                    {
400                        Logging.ATSAdminLog.Error("Could not start the SQL Browser service (13078).");
401                    }
402              }              }
403          }          }
404    
# Line 405  namespace AnywhereTS Line 417  namespace AnywhereTS
417    
418                  }                  }
419              }              }
420              catch              catch(Exception e)
421              {              {
422                  MessageBox.Show("Error, could not configure SQL Browser service (24888). Please check that SQL Server is intalled and that you are logged in with sufficient rights to configure services. Then retry the operation.");                  MessageBox.Show("Error, could not configure SQL Browser service (24888). Please check that SQL Server is intalled and that you are logged in with sufficient rights to configure services. Then retry the operation.");
423                    using (log4net.NDC.Push(string.Format("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", e.Message, System.Environment.NewLine, e.ToString())))
424                    {
425                        Logging.ATSAdminLog.Fatal("Could not configure SQL Browser service (24888). Please check that SQL Server is intalled and that you are logged in with sufficient rights to configure services. Then retry the operation.");
426                    }
427              }              }
428          }          }
429    

Legend:
Removed from v.45  
changed lines
  Added in v.51

  ViewVC Help
Powered by ViewVC 1.1.22