[GridView] Deleting last item causes ArgumentOutOfRangeExceptionwhen using Stored Procedures

Discussion in 'ASP .Net Datagrid Control' started by mc, May 17, 2007.

  1. mc

    mc Guest

    I've been scratching my head for quite a few hours over this issue and thought It might be useful if
    I share my answer.

    Turns out if you are using a stored procedure to delete items from the GridView which updates
    multiple tables or fires triggers this will effect the @@ROWCOUNT value which seems to trip up the
    rendering of the GridView when deleting the last item.

    The fix I settled on was to place a SET NOCOUNT ON at the start of your stored procedure and a SET
    NOCOUNT OFF at the end.

    Regards


    MC
     
    mc, May 17, 2007
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.