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;
-
1Why do you think that won't work in an MVC app? Have you tried it?Sixten Otto– Sixten Otto2009-11-17 17:42:40 +00:00Commented Nov 17, 2009 at 17:42
-
no i am just a beginner can you guide me with a method that does it...ACP– ACP2009-11-17 18:12:53 +00:00Commented Nov 17, 2009 at 18:12
Add a comment
|
2 Answers
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.