Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Connect Linked Server Programmatically C# [duplicate]

Possible Duplicate:
SQL - Connect to Linked Server with Named Instance

I want to connect to a Remote Server DB using Linked Servers. I want this connection to be done by a C# program. How to connect these Linked Servers in C#?

like image 572
Shami Avatar asked Jan 01 '26 01:01

Shami


1 Answers

A linked server is an object on a SQL Server instance, so if you connect to that instance you can query the linked server as if you were quering any other object on one of the instance's databases.

here is an example:

SELECT * 
FROM OPENQUERY ( <linked_server>, 'select code, name, from your_table')

Not sure if this is the answer you were looking for, maybe if you provide more details of your scenario e can help you a little bit more

like image 147
Diego Avatar answered Jan 02 '26 14:01

Diego



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!