Running a SP that does an insert

2 posts, 0 answers
  1. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 07 Jul Link to this post

    We have a SP that does this

    - Check for records
    - If none exist, insert them
    - Return result

    So when I run the SP though OA\DA the insert never happens, if I run it though sql management studio, all is good.  However if I add this.Context.SaveChanges(), the insert works...?  In every case the SP does return the proper data...

    What's going on here, how is the context preventing the insert?

  2. Boyan
    Admin
    Boyan avatar
    100 posts

    Posted 11 Jul Link to this post

    Hi Steve,

    Telerik Data Access will execute the stored procedure in a transaction but it will not commit it automatically - it will expect explicit call to .SaveChanges() to do so. This is done to allow the user to combine the stored procedure call with other actions and commit them all as a single transaction.

    This is why, when the stored procedure is invoked, you receive the record, but the that record is not actually persisted until .SaveChanges() is called. 
    This is the expected behavior and I do not think you can get around it. Could I kindly ask you tell us more about the issue you are experiencing?

    Please refer to this documentation article for further information on how to handle transactions with Telerik Data Access


    I hope this is helpful. Do get back to us with any further questions. 

    Regards,
    Boyan
    Telerik by Progress
     
    Check out the latest announcement about Telerik Data Access vNext as a powerful framework able to solve core development problems.
  3. DevCraft banner
Back to Top