views:

47

answers:

2

I have three databases, x, y, z. Let's assume MS can speak to all of them via odbc or something else.

When I was in webforms I would create a tableadapter and conduct a query. I could do this for each connection I had, so I had three queries.

I would drop each connection and dataset on my page. Each control I used would call the appropriate dataset and populate it's gridview or whatever. All was well. I had three databases, three hits, all on the same page, for one integrated page for the customer.

How can I do this same thing in ASP.NET MVC? Please.

Thank you.

+1  A: 

You get your data from your databases and return all the results in your ViewModel

the simplest way would be to get it all in your controller, assign it to your model the send it to your view

moi_meme
+1 get in your controller (directly or indirectly) and send in a model to the view ...
eglasius
A: 

Using ASP.Net MVC entity framework, create entity classes for each of the 3 databases (Here it's assumed that you are querying entirely different tables from 3 different databases). What you get here are 3 entity classes, each having it's own properties that directly correspond to the table column names you are retrieving. Now, you don't need to worry about 3 databases. Entity framework abstracts it into a set of properties that map into different tables in x,y and z databases you are retrieving from.

A_Var