public string GetDataCompare( DataCompareConfiguration dataCompareConfiguration ) { config = dataCompareConfiguration; var sourceDatabase = SqlSchema.GetDatabase(config.SourceServerName, config.SourceDatabaseName); var targetDatabase = SqlSchema.GetDatabase(config.TargetServerName, config.TargetDatabaseName); var returnScript = new StringBuilder(); returnScript.AppendLine("-- Source Server Name: " + config.SourceServerName); returnScript.AppendLine("-- Source Database Name: " + config.SourceDatabaseName); returnScript.AppendLine("-- Target Server Name: " + config.TargetServerName); returnScript.AppendLine("-- Target Database Name: " + config.TargetDatabaseName); returnScript.AppendLine("-- Run Date: " + DateTime.Now.ToString()); returnScript.AppendLine(); returnScript.AppendLine("USE [" + config.TargetDatabaseName + "];"); returnScript.AppendLine("GO"); returnScript.AppendLine(); returnScript.AppendLine(GetDataChanges(sourceDatabase)); returnScript.AppendLine(); returnScript.AppendLine("GO"); return(returnScript.ToString()); }
private void btnGo_Click(object sender, EventArgs e) { try { txtResults.Text = ""; Application.DoEvents(); Cursor.Current = Cursors.WaitCursor; ValidateInput(); var jobSelection = (JobTypeEntry)cboJobType.SelectedValue; switch (jobSelection.JobTypeId) { case JobTypeEnum.SchemaCompare: var schemaCompare = new SchemaCompare(); txtResults.Text = schemaCompare.GetSchemaCompare(txtSourceServer.Text, txtSourceDatabase.Text, txtTargetServer.Text, txtTargetDatabase.Text); break; case JobTypeEnum.DataCompare: var config = new DataCompareConfiguration(txtSourceServer.Text, txtSourceDatabase.Text, txtTargetServer.Text, txtTargetDatabase.Text); var dataCompare = new DataCompare(); txtResults.Text = dataCompare.GetDataCompare(config); break; default: break; } } catch (Exception exception) { ExceptionHandler(exception); } finally { Cursor.Current = Cursors.Default; } }