tags:

views:

110

answers:

3

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 page System.Configuration.ConfigurationManager.ConnectionStrings["database"].ConnectionString;

+3  A: 

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.

Joseph
plz guide me how it is done in asp.net mvc
Pandiya Chendur
+1  A: 

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...

Hurricanepkt
A: 

i want to validate the user is found or not using ajax when the user "OnKeyUp" in the textbox

alaa