O
O
Oleg2021-11-11 10:30:41
Entity Framework
Oleg, 2021-11-11 10:30:41

How to link tables that are in different databases?

Application on ASP.NET MVC. A field from a table stores the names of the names of tables from another database in which the data is located. It can be processed in VIEW using Razor, but the data must be used in calculations and it is more expedient to receive it in the controller. How to make a request?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir Korotenko, 2021-11-11
@danila_net

Use 2 datasources, and then understand at the code level. In my opinion this is the best solution. And there are plenty of other options.

A
Anton Matushkin, 2021-11-11
@Nanto

You can use the OPENROWSET statement in a query . Using it, you can execute a request to another server as part of a request to one server, specifying all the necessary connection details directly in the operator. The result will be returned as a regular table.
You can also use linked servers .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question