How to call stored procedures from mvc3?

2019-05-12 00:16发布

问题:

I'm trying to use mvc3. The online documentation says how to connect one class to one table. anybody have a suggestion on how to run stored procedures and return the results to a view?

回答1:

MVC is not responsible for the way you access your data. There are many technologies that you can use including

  • Plain old ADO.NET
  • LINQ to SQL
  • NHibernate
  • Entity Framework


回答2:

LINQ to SQL is probably the easiest way to get it working without any prior knowledge. Check out Scott Gu's post http://weblogs.asp.net/scottgu/archive/2007/08/16/linq-to-sql-part-6-retrieving-data-using-stored-procedures.aspx