Last post Jul 21, 2016 12:17 PM by Chris Zhao
Jul 18, 2016 07:12 PM|BFasano|LINK
Ok, so I went and created a Central Management Server with SQL Server 2014. We have an application and it's deployed to each of our office locations. I can run queries against all the site's dbs by using Management Studio. Now, to take it to the next step,
is there a way to connect to it from an application? I'm developing in ASP.net 4.6.1 and would like to be able to query against all the sites at once instead of making a connection to each server separately.
Jul 19, 2016 05:45 AM|eralper|LINK
You can connect to the main SQL Server instance which has linked SQL linked-servers created to all other instances.
This enables you to query other SQL Server instances.
Please check how to
create Linked Server using SQL Server Management Studio
Then you can use following syntax to reference a table which resides on a different SQL Server instance
Jul 19, 2016 08:35 AM|wmec|LINK
Try to put this
<add name="conn2" connectionString="Data Source=192.168.?.?\your_db_instance;Initial Catalog=your_db_schema;Integrated Security=False;User ID=your_db_login;Password=??????" providerName="System.Data.SqlClient"/>
within Web.config/app.config file in your project, to ensure the project will work fine with the database.
Jul 21, 2016 12:17 PM|Chris Zhao|LINK
Take a look at
SQL Server Connection Strings for ASP.NET Web Applications. This topic provides examples of SQL Server connection strings for typical ASP.NET web application scenarios.
<add name="myConnectionString" connectionString="Data Source=xxx.xxx.xxx.xxx,xxxx;
Initial Catalog=myDataBase;User ID=myUsername;Password=myPassword;" providerName="System.Data.SqlClient" />