Changed the requirements of the integrity checking form to need a connection string. The login form willl now attempt to use the connection string setting but failing that it will use the server name in the combo box. The main form will use the app's connection string setting.

This commit is contained in:
2018-02-10 21:39:09 -06:00
parent 2dd754ed29
commit 36bbd29917
3 changed files with 16 additions and 12 deletions
+4 -10
View File
@@ -1,13 +1,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows.Forms;
namespace AdvertsingProfitControl
@@ -19,18 +13,18 @@ namespace AdvertsingProfitControl
private readonly Dictionary<int, DatabaseTable.RepairLevel> _errorsDictionary = new Dictionary<int, DatabaseTable.RepairLevel>();
private readonly List<DatabaseDbCcResult> _databaseDbCcResults = new List<DatabaseDbCcResult>();
public FrmIntegrityCheck()
public FrmIntegrityCheck(string connectionString)
{
InitializeComponent();
RunDbCheck();
RunDbCheck(connectionString);
}
private void RunDbCheck()
private void RunDbCheck(string connectionString)
{
var reportsTable = new DataTable();
try
{
using (var connection = new SqlConnection(Properties.Settings.Default.ConnectionString))
using (var connection = new SqlConnection(connectionString))
{
var query = @"IF NOT OBJECT_ID('tempdb..#CheckDB') IS NULL
DROP TABLE #CheckDB;