ACP
ACP

Reputation: 35264

how to connect to a sql server database in asp.net mvc

Hai guys, how to connect to a sql server database in asp.net mvc ... I know it can be done easily in asp.net web application using web.config and in the aspx pageSystem.Configuration.ConfigurationManager.ConnectionStrings["database"].ConnectionString;

Upvotes: 0

Views: 3054

Answers (2)

MarkKGreenway
MarkKGreenway

Reputation: 8774

I would suggest using an ORM (Such as Linq to SQL)... in addition to SQL server so you can take full advantage of the "M" model part of MVC...

Upvotes: 1

Joseph
Joseph

Reputation: 25533

You can connect to a database in MVC the same way you would in an asp.net web app. There's no difference, save that in a web app you have a code behind, and in MVC you have a controller and presumably a model. Other than that, creating a connection to your database is completely up to you.

Upvotes: 3

Related Questions