[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. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Taras
    Replies:
    2
    Views:
    4,794
    Rick Spiewak
    Oct 5, 2003
  2. loga123
    Replies:
    2
    Views:
    5,677
    loga123
    Jun 28, 2006
  3. Joel  Thornton

    GridView paging/sorting - will it work with stored procedures?

    Joel Thornton, Feb 17, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    177
    Joel Thornton
    Feb 17, 2005
  4. Roberto Kohler

    Gridview - how to use stored procedures to update

    Roberto Kohler, Dec 12, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    6
    Views:
    672
    pavan kumar
    Dec 7, 2006
  5. Joel  Thornton

    GridView paging/sorting - will it work with stored procedures?

    Joel Thornton, Feb 17, 2005, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    353
    Joel Thornton
    Feb 17, 2005
Loading...

Share This Page