stored procedure and multiple calls

  • I am going to have to do a delete once and then insert x amount  of times based off of the number of checkboxes called.

     

    Is it better to enclose the delete function in some kind of counter wrapper and pass it a number var from the C#code to only execute once something like

     

    if @rowCount == 0

    Do delete function here

    End

    do insert function here

     

    or to have 2 seperate stored procedures one for the delete and one for the insert?

     

    if it's better to have 2 procedures then can you call a procedure from another?

     

    if so would it be better to call the delete procedure once or from the code prior to the loop?

  • It is better 2 have 2 different procs/methods 1 for insert 1 for delete. This makes your code more reusable, It will allow you to insert or update in other places in your application.

     

  • Yer I agree

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply