using System.Data.SqlClient;
public static bool AreEqual(string connectionString1, string connectionString2)
{
SqlConnectionStringBuilder connection1 = new SqlConnectionStringBuilder(connectionString1);
SqlConnectionStringBuilder connection2 = new SqlConnectionStringBuilder(connectionString2);
if ((connection1.InitialCatalog.ToLower() == connection2.InitialCatalog.ToLower() ||
connection1.AttachDBFilename.ToLower() == connection2.AttachDBFilename.ToLower()) &&
connection1.DataSource.ToLower() == connection2.DataSource.ToLower())
{
return true;
}
else
{
return false;
}
}
Comments
Post a Comment