LINQ to SQL datacontext update after changing SQL Server name
In a WPF application I use LINQ to SQL, SQL Server 2008.
SQL Server computer was replaced and SQL Server was installed under instance name not the same as before. Database was restored under the same name as before.
The new connection string was added to the application.
But it appeared t开发者_Python百科hat it is impossible for the application to connect to db due to the new instance name. The LINQ to SQL datacontext required to be updated. The problem was solved only after tables were deleted and then again added in the project's LINQ datacontext .dbml page.
Is there a way to change SQL Server instance name without the necessity to edit project in Visual Studio?
Instance name is present only in the connection string. Are you sure that you use the same connection string name in DBML file properties and in web.config? When you connect your server explorer to new database in visual studio and drag the tables to DMBL file, then the new connection string name is created for DBML datacontext - the connection string present in web.config is not used any more. The valid connection string name is visible in properties view after right click on DBML design space.
精彩评论