Quick code review:
removeData
does stuff that accomplishes nothing. You create a new
Room
instance and a new, empty list. The
Room
instance never existed in the list so there's nothing to remove when you call
Remove
. When you pass the list to Dapper, it can't map that to a single INT parameter. Just pass
roomid
in the stored procedure call. As others pointed out,
selection + 1
is wrong and won't work for long; it's pure coincidence. You shouldn't rely on it now or ever. Store the RoomID with the grid row and retrieve that when you need to do anything with that record. —
madreflection 57 secs ago