void IUninstallAction.Run(SetupVariables vars) { try { Log.WriteStart(LogStartUninstallMessage); // Log.WriteInfo(String.Format("Deleting database \"{0}\"", vars.Database)); // if (SqlUtils.DatabaseExists(vars.DbInstallConnectionString, vars.Database)) { SqlUtils.DeleteDatabase(vars.DbInstallConnectionString, vars.Database); // Log.WriteEnd("Deleted database"); } } catch (Exception ex) { if (Utils.IsThreadAbortException(ex)) { return; } Log.WriteError("Database delete error", ex); throw; } }
void IInstallAction.Run(SetupVariables vars) { try { Begin(LogStartInstallMessage); // var connectionString = vars.DbInstallConnectionString; var database = vars.Database; Log.WriteStart(LogStartInstallMessage); Log.WriteInfo(String.Format("SQL Server Database Name: \"{0}\"", database)); // if (SqlUtils.DatabaseExists(connectionString, database)) { throw new Exception(String.Format("SQL Server database \"{0}\" already exists", database)); } SqlUtils.CreateDatabase(connectionString, database); // Log.WriteEnd("Created SQL Server database"); // InstallLog.AppendLine(String.Format("- Created a new SQL Server database \"{0}\"", database)); } catch (Exception ex) { if (Utils.IsThreadAbortException(ex)) { return; } // Log.WriteError("Create database error", ex); // throw; } }