Narendra
Narendra

Reputation: 1

how to access more then one database table on aspx page

i m creating a mvc website in which i want to access more then one table through videwdata.model, how can i do like this or it can do by another way.plz help me

Upvotes: 0

Views: 207

Answers (2)

Darin Dimitrov
Darin Dimitrov

Reputation: 1038780

Views/ASPX pages shouldn't access database. They should only work with the view model which is passed by the controller. Neither the controller should know anything about a database. It uses a service layer which fetches data from somewhere (in your case multiple databases) and returns a model object. In the specific implementation of the service you could perform multiple queries from different databases.

Upvotes: 2

Nick
Nick

Reputation: 3337

You can write multiple linq querys that access the tables you want.

Upvotes: 0

Related Questions