Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

putting result values into array

Status
Not open for further replies.

pandapark

Technical User
Jan 29, 2003
92
GB
Hi

I've used a form wherby the user gets a long list of records, they can select any one to be true - click approve and it runs a sql update to update those records where true was chosen - this works ok

Code:
Dim iCount
iCount = request("Count")
     
Dim strDisplay, strID
Dim strSQL

Dim iLoop
For iLoop = 0 to iCount
strDisplay = Request(iLoop & ".Visible")
strID = Request(iLoop & ".ID")

strSQL = "UPDATE Table1 SET Visible = " & strDisplay & " WHERE ID = " & strID & " "
strSQL1 = "UPDATE Table1 SET Approved = 1 WHERE ID = " & strID & " "

objCon.Execute strSQL
objCon.Execute strSQL1

what i'd like this time is to keep the loop as above, but store the resulting ID's in a array (no need to do the sql update). That way i can pass the array values to another page, use the split function and pass the values into a listbox.

thanks alot !
kim
 
I've managed to get my values in a array now. problem is all the values are been brought across, not just the ones where the user has set select to value 1

this is my latest code

Code:
Dim iCount
iCount = request("Count")

Dim strDisplay, strID
Dim strSQL

Dim iLoop
For iLoop = 0 to iCount
strDisplay = Request(iLoop & ".Visible")

strID = Request(iLoop & ".ID")

firstArray=array(strID)  
b = b & "<input type=""text"" name=""myArray"" value= """ & firstarray(0) & """>"

Next


this is the part of the code for the previous page where the user selects a value of 0 (default) or 1

Code:
Dim iCount
iCount = 0

do until objRS.eof

Visible = request.form("Visible")

if Visible = true then
b = b & "<td width=""10%""><select name=""" & iCount & ".Visible"">"
b = b & "<option value=""0"">-</option>"
b = b & "<option value= ""1"" selected>Select</option>"
b = b & "</select></td>"
else
b = b & "<td width=""10%""><select name=""" & iCount & ".Visible"">"
b = b & "<option value= ""0"" selected>-</option>"
b = b & "<option value= ""1"">Select</option>"
b = b & "</select></td>"
end if

b = b & "</tr>"
b = b & "<td><INPUT TYPE=""hidden"" NAME=""" & iCount & ".ID"" " & "VALUE= """ & objRS("ID") & """></td>"
objRS.MoveNext
loop

thanks
 
I have now got the values where the user selects 1 in a text box as below...............so if the user selects 2 items 2 text boxes appear with the correct ID values. I now need to pass these values to the next page in an array ?
how can i go about doing that ?

thanks

Code:
Dim iCount
iCount = request("Count")

Dim strDisplay, strID

Dim strSQL
Dim iLoop

For iLoop = 0 to iCount
strDisplay = Request(iLoop & ".Visible")

strID = Request(iLoop & ".ID")

arDisplay = Split(strDisplay,",")
arID = split(strID, ",")

for i = 0 to ubound(arDisplay)
	if arDisplay(i) = 1 then
	b = b & "<input type=""text"" name=""myArray"" value= """ & arID(i) & """>"
	else
	end if
	next
Next
 
from your first piece of code...i would simply do...

session("mystring")=strdisplay

and on the next page...

i would just do...

myarray=split(session("mystring"),",")

-DNG
 
thanks DNG

I only need those values that are passed as 1 though, hence the bit of code below.
strDisplay passes through the values of 1 or 0 and strID passes through the ID numbers

Code:
if arDisplay(i) = 1 then
b = b & "<input type=""text"" name=""myArray"" value= """ & arID(i) & """>"
else
end if
 
so my output at the moment is (if they select 3 records for example)

46 50 60

I suppose I could insert these ID values into a temporary table ?
then on the next form select from the temporary table and hey presto !

but could there be a conflict if 2 users are adding at the same time ?

thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top