locked
How to get and post data using mvc5 using ado.net stored procedure RRS feed

  • Question

  • User-471420332 posted

    I have work in one project using mvc5 code first using entity framework 1 year back but now I am trying using stored ado.net to get and post. Please suggest how to achieve using single parameter to post and get using stored procedure.

    Friday, January 22, 2021 4:53 AM

Answers

  • User-939850651 posted

    Hi mazhar khan india,

    I have work in one project using mvc5 code first using entity framework 1 year back but now I am trying using stored ado.net to get and post. Please suggest how to achieve using single parameter to post and get using stored procedure.

    The Entity Framework Code First API includes methods that enable you to pass SQL commands directly to the database.

    Use the Database.SqlQuery method for queries that return types that aren't entities. The returned data isn't tracked by the database context, even if you use this method to retrieve entity types.

    Using it you can easily implement stored procedure calls. For more details, you could read this document.

    Here is a case that has the same requirement as yours, and you could also refer to the answers.

    Call stored procedures with Entity Framework 6 code first approach in Asp.Net MVC 5

    Best regards,

    Xudong Peng

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, January 26, 2021 9:21 AM