
eval to execute - sub - Please Help.
This is one of those examples when one looks at the problem too long
and becomes blind to the obvious.
Dumbo (me) was passing recordset as a String.
Thanks Michael, I can see again.
Quote:
> I'm confused ;-)...
> If the checkCanBuy sub is passed a reference to a recordset object, I
> don't see the purpose of
> -> eval(recordset)("fieldname")
> within the logic in checkCanBuy... Is there a reason why you don't
> simply do
> -> recordset("fieldname")
> directly?
> --
> Michael Harris
> Microsoft.MVP.Scripting
> Seattle WA US
> --
> > Dear Reader thanks in advance for any help/recommendations.
> > Below is a sub that checks the quantity of an item in his/her shopping
> > basket against the qty in stock.
> > Problem is I can't use eval on the service providers server, vbscript
> > engine not V5. ????!!!!!
> > Usually I wouldn't have to pass the RecordSet name but in one case I
> > need to print and check stock of 3 Product tables.
> > Can any 1 think of a better way to do the same thing?
> > I've being trying with execute "function in a string" with absolutly
> > NO luck, it won't "call makeButton".
> > dim inBasket,searchArray,tempBasket
> > sub checkCanBuy (recordset)
> > tempBasket=session("da01cart")
> > searchArray=""
> > inBasket=0
> > for i=lbound(tempBasket) to ubound(tempBasket)
> > searchArray=searchArray &"*"& tempBasket(i,0) &"*"
> > if inBasket=0 and InStr(searchArray,"*"&
> > eval(recordset)("productid") &"*")>0 then
> > inBasket=tempBasket(i,1)
> > end if
> > next
> > if eval(recordset)("stock")=0 or
> > (eval(recordset)("stock")-inBasket)<1 then
> > call makeButton("notify.asp?productid="&
> > eval(recordset)("productid") &"&name="&
> eval(recordset)("name"),"Sold
> > Out")
> > else
> > call makeButton("addprod.asp?productid="&
> > eval(recordset)("productid") &"&action=buy","Add To Basket")
> > end if
> > end sub
> > Thanks again!!!