Type mismatch: 'iProductID' poss prob with array

On my orderConfirmation Page I do this:
strItemID=Request.Form ("txt_itemID")   where txt_itemID is the hidden text field on the CustomerDetails page holding the ID of the product they have chosen.
Again here I use a Select Statement to select the details of the chosen product from my database like this:
dim arrProducts(3,3)
dim i
i=0
SQLQuerymake= "SELECT * FROM tbl_photography where picID= " & strItemID & ""
set rs_pics=objconn.execute(SQLQuerymake)

WHILE NOT rs_pics.EOF
      arrProducts(i,1)= rs_pics("picID")      
      arrProducts(i,2)= rs_pics("price_a3")
 arrProducts(i,3)= rs_pics("small_photo")      
      i = i + 1
  rs_pics.movenext
WEND
But on  the orderConfirmation Page I am getting the error message:
Type mismatch: 'iProductID'
/orderConfirmation_TUE.asp, line 83
Where line 83 is:
sngTotal=sngTotal + (cint(iQuantity) * csng(arrProducts(iProductID,2)))

Can you explain why?

rabbits2Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

GawaiCommented:
change to
SQLQuerymake= "SELECT * FROM tbl_photography where picID= '" & strItemID & "'"
0
GawaiCommented:
if txt_itemID data type is text or not an integer then my above code should work.
you should wrap the text with '
0
Mass Dot NetCommented:
Let's dig a bit deeper.  Add some debugging code on your order confirmation page, like so:

=====================================================
Call Response.Write("iQuantity = " & iQuantity & "<br>" & vbNewLine)
Call Response.Write("iProductID = " & iProductID & "<br>" & vbNewLine)
Call Response.Write("arrProducts(" & iProductID & ",2) = " & arrProducts(iProductID,2) & "<br>" & vbNewLine)
Call Response.Write("cSng(arrProducts(" & iProductID & ",2)) = " & CSng(arrProducts(iProductID,2)) & "<br>" & vbNewLine)

sngTotal=sngTotal + (cint(iQuantity) * csng(arrProducts(iProductID,2)))
=====================================================


Which line does the error occur on now?  My guess is that you're looking in the wrong place in the arrProducts array.  But without being able to see the order confirmation page's code, I can't be sure.


-= DeathToSpam =-
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

rabbits2Author Commented:
txt_itemID data type is an Atomated number.
I will try with the debugging now, thanks.
0
golfDoctorCommented:
In the code you posted, you never assign a value to iProductID, but you use it as integer.  That would cause error.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rabbits2Author Commented:
After debugging I get this response:
iQuantity =
iProductID =
arrProducts(,2) = 180
cSng(arrProducts(,2)) = 180

Microsoft VBScript runtime error '800a000d'
Type mismatch: ''
/orderConfirmation_TUE.asp, line 91
Where line 91 is the same line where the error occured before:
sngTotal=sngTotal + (cint(iQuantity) * csng(arrProducts(iProductID,2)))

So I am missing some required data, no?
0
rabbits2Author Commented:
180 is the individual item price, but I had selected 2
0
golfDoctorCommented:
Like I said, "you never assign a value to iProductID, but you use it as integer.  That would cause error."
0
Mass Dot NetCommented:
Rabbits2 --

You'll notice that the value of [iProductID] is blank.  Because you're using [iProductID] to try and figure out which row in the [arrProducts] array you want to get the price from, that's causing any error -- it should be displaying an integer, at the very least.

You'll need to post more of your confirmation page's code -- I really can't say what else might be going wrong, without seeing it.


-= DTS =-
0
rabbits2Author Commented:
I will try and sort my code so as not to post too much.  This may take me a while, please check back tomorrow. Thanks for yr help so far.
The problem is I am passing a cart over three pages and this is the first time I have done this, I can't possibly post three pages of script for you to paw through so will try and organise the specifics of what I need to achieve. thanks
0
golfDoctorCommented:
put all the values in session variables, add new in each page, rather than passing through pages.
0
rabbits2Author Commented:
ok will give it a go. Thanks
0
Computer101Commented:
Forced accept.

Computer101
EE Admin
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.