Friday, 6 September 2013

Trying to delete members via a listbox - how to call my delete function passing the member's id?

Trying to delete members via a listbox - how to call my delete function
passing the member's id?

To list all my members, I simply run a function that runs a SELECT query
(mssql) and lists all users by frst name / last name. I also fetch the
user id there.
To delete a user, I have a delete button, which runs a delete function
that runs a query such as
DELETE FROM members where id = @id
However, for the @id, I use the SelectedIndex, which of course is not
always equal to the user ID. I'd like to pass the user ID to my delete
function as a param but I'm not sure how.
I tried creating a hidden textBox for each member, with their ID in it,
but it failed and doesn't seem like the best way to do it even if I
succeed with that technique.
How would you go about it?
Thanks

No comments:

Post a Comment