MVC - Select from Stored Procedure in Entity Framework

雨燕双飞 提交于 2019-12-23 02:54:35

问题


I am new to ASP.NET MVC. I should create a page where users enters an order for their shops by central warehouse. The products and amounts are listed by a stored procedure from database. I have to show rows in a gridview which are calculated by the stored procedure. I want to insert the changed data in a table in SQL after the user make changes on the gridview. Users can call the saved doc back and make changes on it and save it again.

I can't build a strategy how that can be made. If I use Entity Framework I can show the SQL table rows in grid but it is not my goal. I have to let the SQL calculate first the data. Could you please give me some start point and steps to go ahead. I hope I could explain what I need.


回答1:


There Are some simple steps to do that

1- Go and update model from database and add the required Stored procedure

2- create a complex type from model browser

in complex type map your Stored procedure fields as it returns the data.

3- and map that complex type to the stored procedure. and use it as you use table.



来源:https://stackoverflow.com/questions/34761857/mvc-select-from-stored-procedure-in-entity-framework

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!