Use new generic property (ActiveDatabase) to access the current database name. Info in email message

This commit is contained in:
Rich 2014-09-03 19:37:58 +00:00
parent 3a7667d9b7
commit f8aad3efbc

View File

@ -119,9 +119,9 @@ namespace Volian.Controls.Library
Match mServer = Regex.Match(connectionString, ".*Data Source=([^;]*).*");
string server = (mServer.Success) ? mServer.Groups[1].Value : "unknown";
if (server.StartsWith(@".\")) server = @"Local \ " + server.Substring(2);
string databaseName = Database.SelectedDatabase;
string databaseName = Database.ActiveDatabase;
sb.Append(string.Format("SQL Server: {0}", server));
if (databaseName == null) databaseName = Regex.Replace(connectionString, "^.*Initial Catalog=([^;]*);.*$", "$1", RegexOptions.IgnoreCase);
//if (databaseName == null) databaseName = Regex.Replace(connectionString, "^.*Initial Catalog=([^;]*);.*$", "$1", RegexOptions.IgnoreCase);
sb.AppendLine(string.Format("\t\tDatabase: {0}", databaseName));
if (OutlookEmail)
sb.AppendLine("sent via outlook");