DELETE multiple records with checkbox in asp
Bonjour,
je voulais faire une suppression multiple avec checkbox.
Je suis débutante en asp et je travaille sur une base access.
j'ai essayé de mettre ce code mais il m'affiche une erreur.
Le code du formulaire est le suivant :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
<%
sql = "SELECT * FROM FAQ"
Set faqM = Server.CreateObject("ADODB.Recordset")
faqM.Open sql, conn, 3, 3
%>
<form action="GestionFAQ.asp" method="post">
<input type="image" src="img/cancel.png" name="Submit" value="Supprimer"> <br><br>
<table width="704" border="0" cellpadding="0" cellspacing="0" class="display" id="example" style="width:750px;">
<thead>
<tr>
<th width="51"> </th>
<th width="162" class="sorting_asc">Categorie</th>
<th width="259" class="sorting">Question</th>
<th width="278" class="sorting">Réponse</th>
</tr>
</thead>
<tbody>
<%
faqM.movefirst
do while not faqM.eof
categorie=faqM.fields("categorie")
question=faqM.fields("question")
reponse=faqM.fields("reponse")
idFAQ=faqM.fields("idFAQ")
%>
<tr class="gradeA odd">
<td class="center"><input name="Supprimer[]" type="checkbox" id="Supprimer[]" value="<%=idFAQ%>"></td>
<td onDblClick="inlineMod(<%=idFAQ%>, this, 'categorie', 'Texte', 'FAQ', 'idFAQ');"><%=categorie%></td>
<td onDblClick="inlineMod(<%=idFAQ%>, this, 'question', 'Texte', 'FAQ', 'idFAQ');"><%=question %></td>
<td onDblClick="inlineMod(<%=idFAQ%>, this, 'reponse', 'TexteMulti', 'FAQ', 'idFAQ');"><%=reponse%></td>
</tr>
<%
faqM.movenext
loop
%>
</tbody>
</table><br>
<br>
</form> |
le code du suppression est le suivant :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
<%
Set conn = Server.CreateObject("ADODB.Connection")
DSN_BASE="DBQ="& Server.Mappath("../database/produits.mdb")&";Driver={Microsoft Access Driver (*.mdb)};DriverId=25"
conn.Open DSN_BASE
%>
<%
if(Request("Submit") <> "") then
commDelete__intRecordsIDs = Request("Submit")
set commDelete = Server.CreateObject("ADODB.Command")
commDelete.ActiveConnection = conn
commDelete.CommandText = "DELETE FROM FAQ WHERE idFAQ IN (" + Replace(commDelete__intRecordsIDs, "'", "''") + ")"
commDelete.CommandType = 1
commDelete.CommandTimeout = 0
commDelete.Prepared = true
commDelete.Execute()
Response.Redirect("GestionFAQ.asp")
end if
%> |
L'erreur est la suivante :
Code:
1 2 3 4 5 6
|
Microsoft OLE DB Provider for ODBC Drivers erreur '80040e10'
[Microsoft][Pilote ODBC Microsoft Access] Trop peu de paramètres. 1 attendu.
/client/GestionFAQ.asp, ligne 19 |
la ligne 19 concerne commDelete.Execute()
Avez vous d'idée ??
Merci d'avance.