Parent Directory
|
Revision Log
|
Patch
--- trunk/TSAdminTool/Database.cs 2012/07/11 16:01:40 10 +++ trunk/TSAdminTool/Database.cs 2012/07/11 16:48:23 17 @@ -21,7 +21,8 @@ private SqlCommand sqlCmd = new SqlCommand(); const string SQL_BROWSER_SERVICE_NAME = "SQLBrowser"; - + + public static string InstanceName = Properties.Settings.Default.atsConnectionString.Substring(Properties.Settings.Default.atsConnectionString.IndexOf(@"\"), Properties.Settings.Default.atsConnectionString.IndexOf(@";")).Replace(@"\", "").Replace(@";", ""); public bool SetupDatabase() { bool bContinue = false; @@ -34,7 +35,7 @@ } catch (SqlException sql_ex) { - MessageBox.Show("Fail to connect to SQL Server Express\n" + sql_ex.Number.ToString() + " " + sql_ex.Message.ToString()); + MessageBox.Show(string.Format("Fail to connect to SQL Server Instance: {0}\n", InstanceName) + sql_ex.Number.ToString() + " " + sql_ex.Message.ToString()); return bContinue; } @@ -265,7 +266,7 @@ } catch { - MessageBox.Show("Error, could not configure SQL Browser service (24888). Please check that SQL Server Express 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."); } } @@ -284,7 +285,7 @@ { prot.Get(); if ((string)prot.GetPropertyValue("ProtocolName") == "Np" && //Named pipes - (string)prot.GetPropertyValue("InstanceName") == "SQLEXPRESS") + (string)prot.GetPropertyValue("InstanceName") == InstanceName) { // We found the named pipes protocol if (!(bool)prot.GetPropertyValue("Enabled")) { // Named pipes not activated @@ -292,7 +293,7 @@ // Check if user wants to restart SQL server DialogResult resultRights; - resultRights = MessageBox.Show("In order for users to use the AnywhereTS control panel, the SQL Express service on this computer need to be restarted. This operation might take up to 60 seconds. Do you want restart the SQL Express service now?", "AnywhereTS - Restart SQL Express (This operation might take up to 60 seconds!)", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1); + resultRights = MessageBox.Show(string.Format("In order for users to use the AnywhereTS control panel, the {0} service on this computer need to be restarted. This operation might take up to 60 seconds. Do you want restart the {0} service now?", InstanceName), string.Format("AnywhereTS - Restart {0} (This operation might take up to 60 seconds!)", InstanceName), MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1); if (resultRights == DialogResult.Yes) { // Restart the SQL server @@ -301,7 +302,7 @@ foreach (ManagementObject svc in sqlServicesMan.GetInstances()) { if ((uint)svc.GetPropertyValue("SqlServiceType") == sqlServerService && - (string)svc.GetPropertyValue("ServiceName") == "MSSQL$SQLEXPRESS") + (string)svc.GetPropertyValue("ServiceName") == string.Format("MSSQL${0}", InstanceName)) { svc.Get(); if ((uint)svc.GetPropertyValue("State") != sqlServiceStopped)
ViewVC Help | |
Powered by ViewVC 1.1.22 |