csteinhilber
Programmer
I'm using classic ASP/VBScript.
I have a module that builds up an in memory recordset (no DB is immediately available), like:
I use this recordset to output a form that allows the user to select items (checkboxes).
On the page that the form submits to, I'd like to load up the same in memory recordset, and then execute a select on it based on the selected checkboxes.
Something like:
After which selectedItems should have something like '0','1A34','4321','55E5'
Then I basically want to perform something like
SELECT * FROM {RS} WHERE ID IN (selectedItems)
But I can't find any documentation to suggest that I can execute SELECTs on recordsets that are already present in memory.
Anyone know if this is possible?
The only other solution I can think of is to loop through the all the rows in the recordset manually and check the row's ID against each of the IDs in the selectedItems list... but that seems tremendously inefficient and I'm hoping there's another solution I'm not thinking of.
Any ideas?
Thanks in advance!
-Carl
I have a module that builds up an in memory recordset (no DB is immediately available), like:
Code:
Const aVarChar = 200
Set rs = CreateObject("ADOR.Recordset")
rs.Fields.Append "id", aVarChar, 15
rs.Fields.Append "name", aVarChar, 50
rs.Fields.Append "img", aVarChar, 255
rs.Open
rs.AddNew
rs("id") = "id1"
rs("name") = "Name 1"
rs("img") = "/image/image1.jpg"
rs.Update
:
Code:
<input type="checkbox" name="<%= rs.Fields.Item("id") %>" value="1" />
Something like:
Code:
Dim selectedItems
selectedItems = "'0'"
For Each Field In Request.Form
fieldVal = Request.Form(Field)
if Len(Trim(fieldVal)) > 0 then
selectedItems=selectedItems & ",'" & Field & "'"
end if
Next
Then I basically want to perform something like
SELECT * FROM {RS} WHERE ID IN (selectedItems)
But I can't find any documentation to suggest that I can execute SELECTs on recordsets that are already present in memory.
Anyone know if this is possible?
The only other solution I can think of is to loop through the all the rows in the recordset manually and check the row's ID against each of the IDs in the selectedItems list... but that seems tremendously inefficient and I'm hoping there's another solution I'm not thinking of.
Any ideas?
Thanks in advance!
-Carl