access_asp thread: Joining Arrays
Message #1 by "ANTONIO JONES" <ajjones13@m...> on Thu, 2 May 2002 18:11:07
|
|
Here I have two arrays coming over :
15, Chef Salad is a product array and 3, 5, 4, 2, 1, 1, 1, 9 is a quantity
array
This is how the error looks:
15,Classic Chef Salad3, 5, 4, 2, 1, 1, 1, 9
It should bring over both strings and match up the product(ID & Name) with
the quantity
15,Classic Chef Salad,3
Here's some of the code: All variables have been assigned
for each item in Request.form("strAddProducts")
strAddProducts = cstr(item)
Response.Write (strAddProducts)
Quantities = Request("quant")
Response.Write(quantities)
itemInfo = split(strAddProducts, ",")
QuantArray = split(quantities,",",-1,1)
rsAdd.addNew
rsAdd("orderID") = intOrderID
rsAdd("productID") = itemInfo(0)
rsAdd("pName") = itemInfo(1)
rsAdd("quantity") = QuantArray
rsAdd.Update
AddToOrder intOrderID, intProdID, strName, intQuant
next
Message #2 by "Santhi" <santhi_maadhaven@y...> on Fri, 10 May 2002 12:57:31
|
|
Hi,
The problem is with split(quantities,",",-1,1)
-1 -- returns all the substrings present
Try without "-1" option.
You can get the correct result
>
H> ere I have two arrays coming over :
1> 5, Chef Salad is a product array and 3, 5, 4, 2, 1, 1, 1, 9 is a
quantity
a> rray
> This is how the error looks:
1> 5,Classic Chef Salad3, 5, 4, 2, 1, 1, 1, 9
> It should bring over both strings and match up the product(ID & Name)
with
t> he quantity
1> 5,Classic Chef Salad,3
>
> Here's some of the code: All variables have been assigned
> for each item in Request.form("strAddProducts")
>
> strAddProducts = cstr(item)
> Response.Write (strAddProducts)
> Quantities = Request("quant")
> Response.Write(quantities)
> itemInfo = split(strAddProducts, ",")
> QuantArray = split(quantities,",",-1,1)
> rsAdd.addNew
> rsAdd("orderID") = intOrderID
> rsAdd("productID") = itemInfo(0)
> rsAdd("pName") = itemInfo(1)
> rsAdd("quantity") = QuantArray
> rsAdd.Update
> AddToOrder intOrderID, intProdID, strName, intQuant
> next
|