View Single Post
  #1 (permalink)  
Old Mar 28th, 2008, 11:04
FlashO FlashO is offline
New Member
Join Date: Mar 2008
Location: Spain
Age: 22
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
delete by checkbox

Hello, I would like delete records from my database with a checkbox. Show registration which is in my database and next would like a checkbox, and eliminate selected registration.
I am using this code I found in this forum but can not make it work, you can help me?
Code: Select all
<%
session("servidor")="********"
 
session("usuariobd")="*****"
 
session("contrasenabd")="******"
 
session("bd")="*******"
dim conexion
set conexion = Server.CreateObject("ADODB.Connection")
 
 
Dim pm, conn, rsCount
 
Set conn = Server.CreateObject("ADODB.Connection")
Set pm = Server.CreateObject("ADODB.Recordset") 
conn.Open = "driver={MySQL};server="&session("servidor")&";uid="&session("usuariobd")&";pwd="&session("contrasenabd")&";database="&session("bd")&""
Dim comment
 
For Each comment In Request("delete")
pm.Open "DELETE FROM usuario WHERE id = "& comment &"", conn,3,3
'Set pm = conn.Execute ("DELETE FROM userpm WHERE pmNo = "& comment &"") Can be done like this too, I don't have idea what is the different??
Next 
pm.Open "SELECT Nombre,Apellidos,Teléfono, Foto FROM usuario WHERE Nombre = '" & Session ("usuariobd") & "' ORDER BY id DESC", conn
'Set pm = conn.Execute ("DELETE FROM userpm WHERE pmNo = "& comment &"") Can be done like this too, I don't have idea what is the different??
 
 
%>
 
<input type="checkbox" name="delete" title="Select" value="<%=pm("id")%>">
Reply With Quote