Hi Marnus,
This was discussed in this/other thread many times, but with the new changed UI, I am not able to find that easily out for you. Any search now hits the entire forum and I got to scroll through 50 odd pages to find that out. Maybe, got to get used to this new UI. I am unable to locate the old Search facility(if at all it is there) that lets one to search based on forum/thread and was a good and easy way to find things. I don't see that here now. Maybe if someone finds let me know. Not only that, I find it odd/difficult to get adapted with content in BLACK letters. The old UI was so good. Don't know why a sudden revamp of the site.
So let me explain you on how to go with the checkbox thing.
You should be looping through the recordset for displaying the data in a table. Within that loop, you got to use checkbox that has the same name for every instance.
Code:
Loop_Start
<td><input type="checkbox" name="chkDelete" value='<%=rs("IDFIELD")%>'></td>
<td>COL1 - Your record displaying code...</td>
<td>Col2 - Your record displaying code...</td>
Loop_End
Suppose, you have listed records from 1-10, and check box is ticked for 1, 4, 5, 8. When you request the value of that checkbox after form submit.
Response.write Request.Form("chkDelete")
would result in
1,4,5,8 all comma separated.
You can split that into an array or process that as such.
For delete, it is sufficient that it is comma seperated, so that you can use the query as
Code:
strsql="delete from mytable where idfield in (" & Request.Form("chkDelete") & ")"
Which would result in query as
Code:
delete from mytable where idfield in (1,4,5,8)
I won't suggest this method for update, for which you got to provide all the columns as editable and on checked status of the CHECKBOX, you got to capture the data for relevant rows and update them in a batch, which would be a little more complex. If you are comfortable with it, you can go ahead with this, but you got to use SPLIT function to split the 1,4,5,8 into an array and loop through each value to construct the UPDATE statement and proceed further.
Hope that helps.
Cheers!
_________________________
- Vijay G

Strive for Perfection
