Hi, guys. How are you?
It is pretty warm here in New zealand. Spring here!
Anyway, can I ask you this thing?
What I am trying to do is:
1.show the list of wine ( access database) using ASP and ADO.
2.Each item has checkbox to be deleted.
3.All the checked list has to be deleted all at once when user hit delete button.
I wrote a code do delete like this:
code:
Dim sql
If Request.Form("action") = "Delete" Then
Dim s
s = Request.Form("delete")
'response.write(s)
's is ID which you choose to delete. 1, 23, 12 something like that.
'so that you have to replace each space or , to "" (means nothing).
'Hmm.....why????
s = Replace(s, " ", "")
s = Replace(s, ",", "")
If IsNumeric(s) Then
sql = "DELETE FROM tblWine WHERE[ID] IN("& Request.Form("delete") & ") "
Err.Clear
On Error Resume Next
conn.Execute sql
If Err.Number <> 0 Then
Response.Write "error"
End IF
End IF
End
And in html form, inside of table:
code:
<td><input type="checkbox" name="delete" value="<%=x.value%>"></td>
Basiclly it works fine. But I don't understand how those replace (s, " ", "") works.
Without that, I cannot delete multiple items but single.
When I do like:
Response.Write(Request.Form("delete)),
it shows 1, 3, 4, 12 or whichever ID number where I checked.
Hmm....confused.
@_@ Help, please.
Hiroki Kozai