1

I am an asp.net webforms developer and new to asp.net MVC....

Is it possible to use SQL Server 2005 stored procedures in asp.net MVC?? If so can any one help me....

3 Answers 3

5

This is absolutely possible. Although it claims to be a Model View Controller framework, ASP.NET MVC is really just View Controller, it's up to you the developer to decide and implement a model persistence layer.

As a WebForms developer you're likely familiar with DataSets, however these are usually avoided in an ASP.NET MVC application in favour of an ORM framework like NHibernate or Linq2Sql, both of which have plenty of resources online for integration with ASP.NET MVC. As a good starting point, you might want to look at S#arp Architecture which is a good example of a best practice MVC stack.

Sign up to request clarification or add additional context in comments.

2 Comments

@Rory:Can you give a sample code or functionality to use sql server stored procedures in MVC
How you call stored procedures depends on the persistence framework you choose. Once you've picked one I suggest you have a look at the documentation and post new questions if you still need help.
2

Using stored procedures is not directly related to which type of application you are building. You could use the same type of data access code as you are used to from WebForms, such as ADO.NET (SqlConnection, SqlCommand etc.).

Comments

0

Absolutely agree with answers above, my advice is to use Entity framework or LINQ2SQL and simply import stored procedure as function which you can use as dbContext.Somemehto();

Stored procedure should only be linked with Model that is pure sever code, so there is no difference in using it from Desktop application or from Model. If it is not distributed database.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.