Lättast är om du ger varje checkbox samma namn, och ger dom värdet av det id som inlägget har...
Sedan tar du emot såhär:
deletes = Split(Request.Form("checks"),", ")
strSQL = "Delete from tabell where "
For i = 0 To Ubound(deletes)
strSQL = strSQL & "id = "&deletes(i)&" OR "
Next
strSQL = Left(strSQL, Len(strSQL)-3)
databas.execute(strSQL)
Kanske lite syntaxfel... men principen borde funka... :)
strDel = Request.Form("del")
arrDel = Split(strDel,",")
For i = 0 to UBound(arrDel)
strSQLdel = "DELETE * FROM DIN_TABELL WHERE DITT_FALT_ID = " & arrDel(i)
objConn.Execute(strSQLdel)
Next
ngt liknande ...
cya,
------------------ Private Function OutPut(ByRef sString)
OutPut = "Who gives ..." & sString
End Function
Vides variant är funkis. Här är tre till (bara för att visa olika kodningetekniker som man kanske inte tänker på så ofta)
strSQL = "Delete from tabell where "
For each intID in Request.Form("checks")
strSQL = strSQL & "id = "& intID &" OR "
Next
strSQL = Left(strSQL, Len(strSQL)-3)
databas.execute(strSQL)
eller
deletes = Split(Request.Form("checks"),", ")
strSQL = "Delete from tabell where ID=" & join(deletes," OR ID=")
databas.execute(strSQL)
eller
strSQL = "Delete from tabell where ID IN (" & Request.Form("checks") & ")"
databas.execute(strSQL)
strSQL = "DELETE * FROM post WHERE "
For each intID in Request.Form("fld_checkbox")
strSQL = strSQL & "id = "& intID &" OR "
Next
strSQL = Left(strSQL, Len(strSQL)-3)
objConn.Execute(strSQL)
Funkar bra... :e
------------------ Det är lättare att leva ett rikt liv som ung, när man vet att det väntar ett som gammal
E-post
strSQL = "Delete from tabell where "
For i = 1 to 3
strSQL = strSQL & "id = "& request.form("checkbox" & i) & " OR "
Next
strSQL = Left(strSQL, Len(strSQL)-3)
databas.execute strSQL,,128
intAntalCheckbox = 0
For each objItem in Request.Form
If Left(objItem, 8) = "checkbox" Then
intAntalCheckbox = intAntalChecbox -- 1
End If
Next
strSQL = "Delete from tabell where "
For i = 1 to intAntalCheckBox
strSQL = strSQL & "id = "& request.form("checkbox" & i) & " OR "
Next
strSQL = Left(strSQL, Len(strSQL)-3)
databas.execute strSQL,,128