Created a new form to allow the user to check the database for internal errors. Needs more testing so this build will have the option not visible. Modified the login form to display database tools.

This commit is contained in:
2018-01-13 03:24:59 -06:00
parent 6ec32afc92
commit 2dd754ed29
10 changed files with 6980 additions and 22 deletions
+3 -3
View File
@@ -18,10 +18,10 @@ namespace AdvertisingProfitControlData
public byte State;
public string ErrorMessage = string.Empty;
public bool SingleFileBackup(string optionalBackupFilePath = "")
public bool SingleFileBackup(string connectionString, string optionalBackupFilePath = "")
{
var defaultBackupFile = DefaultBackupLocation + DateTime.Now.ToString("yy-MM-dd") + "." + DefaultBackupExtension;
var sqlConStrBuilder = new SqlConnectionStringBuilder(AdvertisingProfitControlDbContext.ConnectionString);
var sqlConStrBuilder = new SqlConnectionStringBuilder(connectionString);
try
{
using (var sqlConnection = new SqlConnection(sqlConStrBuilder.ConnectionString))
@@ -33,7 +33,7 @@ namespace AdvertisingProfitControlData
State += e.Errors[e.Errors.Count - 1].State % 5 == 0 ? e.Errors[e.Errors.Count - 1].State : (byte) 0;
}
};
//Note: To get a SqlException an error must be raised at level 16 or higher.
//Note: To get a SqlException an error must be raised at level 11 or higher.
//Checksum command needs to be applied in order to properly verify the media as pointed out here:
//http://www.edwinmsarmiento.com/the-scariest-lie-we-believed-about-backup-verification/
//RAISERROR(message string, level, state) levels above 11 throw SQLExceptions.