Forums
This topic is locked
Checkbox Multiple Delete using Array - Object
Posted 20 Aug 2006 11:08:28
1
has voted
20 Aug 2006 11:08:28 power power posted:
Having trouble with my query. Probably a beginner problem wondering if anyone can help,I am trying to use a form with checkbox next to records, and once selected for deletion, it will send selected field's value in name instead of ID, for example, "1234.jpg". I use name because after successfully deleting the name from record, it will also be used to delete some picture files. Below is a reduced code, I am just a beginner starting to learn ASP and probably made some simple and stupid mistakes.
When I tried to run the code below, I get error that "Object Required"
Sample Code Below:
==========================================================
On Error Resume Next
Set Conn = Server.CreateObject("ADODB.Connection"
Conn.Open ASPConn 'Connection is open'
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Form sent fields checkbox values, name PicName
strPicNames = Replace(Request.Form, "&PicName=", ","
strPicNames = Replace(strPicNames, "PicName=", ""
arrPicNames = Split(strPicNames, ","
For intCount = 0 To UBound(arrPicNames)
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Trying to use array as part of the query string below
MyQuery = "Select * From PhotoCollection" & " Where PicName = " & arrPicNames(intCount)
rs.open MyQuery,Conn,3,3
rs.Delete
rs.Close
Set rs = Nothing
Next
Conn.Close
Set Conn = Nothing