user8311110
user8311110

Reputation:

Can i create different Sql connection in Mvc Areas

I am using MVC5, how can I use different databases for different controllers ? I have a connection string in my root web.config and I wrote a different connection string in the area's web.config. Why can I not connect to a different DB ?

Upvotes: 1

Views: 199

Answers (2)

Mathieu VIALES
Mathieu VIALES

Reputation: 4772

Make sure that you gave your second connection string a different name. Names must be unique. Also, you can just declare them all in the web.config that is at the root of your project.

Upvotes: 0

Jilani pasha
Jilani pasha

Reputation: 407

You can declare multiple connection strings in global "web.config" file, and use required connection string at multiple places in the project...

Upvotes: 1

Related Questions