Click here to Skip to main content
15,887,875 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello

I want to write a c# program which is one of settings of application use one mssql server and the other settings use different mssql server is it possible?
Can i connect 2 different sql server same application same time?
How can i do this?

What I have tried:

some search,google search,looking some books
Posted
Updated 27-Sep-17 4:33am

1 solution

Yes, all you need is two SqlConnection objects.
You can't "combine" two servers in the the same query: for example you can't use a JOIN to SELECT related records from two tables on different servers. But you can issue SQL commands to one or the other.

What exactly are you trying to do?
 
Share this answer
 
Comments
[no name] 27-Sep-17 11:11am    
"You can't 'combine' two servers in the the same query": I would say that is not correct.
With a "Linked Server" it is possible.
OriginalGriff 27-Sep-17 11:27am    
Yes, if you have linked servers you can. But ... from the question, do you think he's that far advanced? :laugh:

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900