0

I am looking for a way of displaying data from 2 different databases on different servers within 1 datatable on a asp.net/c# web application. To explain further I have one database which holds data on different buildings such as space size, address, number of floors. This is on Server 1 and is a MSSQL Server DB. The second server has the same list of buildings but different data, lease details, costs ect. This is on server 2 and is a MySQL DB Server. My question is how do I do a join on these two tables in c# code?

Thanks in advance for any help

Kev
  • 121
  • 3
  • 20
  • 1
    if you want to use join in C# code then you might consider `LINQ` here for join. check this `http://msdn.microsoft.com/en-us/library/bb397895.aspx` – Rohit Jan 08 '15 at 14:37
  • 1
    Does [Selecting data from two different servers in SQL Server](http://stackoverflow.com/questions/1144051/selecting-data-from-two-different-servers-in-sql-server) in conjunction with [Link MySQL to MS SQL](https://dbperf.wordpress.com/2010/07/22/link-mysql-to-ms-sql-server2008/) help? – Corak Jan 08 '15 at 14:42
  • 1
    You can define a linked server so that your mysql data is available in your sql server, and then build a view referencing that: your C# code can thus work exclusively with SQL Server objects. – davek Jan 08 '15 at 14:42
  • 2
    Answer is [`OPENQUERY (Transact-SQL)`](http://msdn.microsoft.com/en-us/library/ms188427.aspx) – Avijit Jan 08 '15 at 14:46

0 Answers0