I was using the AttachDBFilename and discovered that the database name ended up being the full path of the file being attached.
Setting InitialCatalog as well enable me to control the catalog name of the attached file.
var cb = new SqlConnectionStringBuilder {
IntegratedSecurity = true,
DataSource = ".\MyInstance",
AttachDBFilename = @"c:\mypath\mydb.mdf",
InitialCatalog = "mydb catalog name"
};
No comments:
Post a Comment