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

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

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