Skip to content

Commit

Permalink
Fix SSMS crash due to MDS 3.1 in SSMS 20
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikEJ committed Nov 7, 2024
1 parent b08419a commit 2f8d5e5
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/GUI/SSMSToolbox/SSMSEngine/DatabaseMenuItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,11 @@ private MenuItem BuildMenuItemForCommandHandler()
var parent = Parent;
if (parent?.Connection == null) return null;

var builder = new SqlConnectionStringBuilder(parent.Connection.ConnectionString);
var connectionString = parent.Connection.ConnectionString;

connectionString = ReplaceMdsKeywords(connectionString);

var builder = new SqlConnectionStringBuilder(connectionString);
builder.InitialCatalog = parent.InvariantName;

var dbInfo = new DatabaseInfo
Expand Down Expand Up @@ -175,5 +179,12 @@ private ToolStripMenuItem BuildScriptMenuItem(System.Drawing.Bitmap scriptImage)
scriptItem.DropDownItems.Add(scriptItem5);
return scriptItem;
}

private string ReplaceMdsKeywords(string connectionString)
{
connectionString = connectionString.Replace("Multiple Active Result Sets=", "MultipleActiveResultSets=");
connectionString = connectionString.Replace("Trust Server Certificate=", "TrustServerCertificate=");
return connectionString;
}
}
}

0 comments on commit 2f8d5e5

Please sign in to comment.