Exemplo n.º 1
0
        private void DeleteDatabaseUser(string connectionString, string username)
        {
            try
            {
                Log.WriteStart("Deleting SQL server user");
                Log.WriteInfo(string.Format("Deleting \"{0}\" SQL server user", username));
                if (SqlUtils.UserExists(connectionString, username))
                {
                    SqlUtils.DeleteUser(connectionString, username);
                    Log.WriteEnd("Deleted SQL server user");
                    InstallLog.AppendLine(string.Format("- Deleted \"{0}\" SQL server user ", username));
                }
            }
            catch (Exception ex)
            {
                if (Utils.IsThreadAbortException(ex))
                {
                    return;
                }

                Log.WriteError("Database user delete error", ex);
                InstallLog.AppendLine(string.Format("- Failed to delete \"{0}\" SQL server user ", username));
                throw;
            }
        }
Exemplo n.º 2
0
        private static void DeleteDatabaseUser(string connectionString, string username)
        {
            try
            {
                Log.WriteStart("Deleting database user");
                Log.WriteInfo(string.Format("Deleting database user \"{0}\"", username));
                if (SqlUtils.UserExists(connectionString, username))
                {
                    SqlUtils.DeleteUser(connectionString, username);
                    Log.WriteEnd("Deleted database user");
                }
            }
            catch (Exception ex)
            {
                if (Utils.IsThreadAbortException(ex))
                {
                    return;
                }

                Log.WriteError("Database user delete error", ex);
                throw;
            }
        }