[GridView] Deleting last item causes ArgumentOutOfRangeExceptionwhen using Stored Procedures

M

mc

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
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,040
Latest member
papereejit

Latest Threads

Top