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
SQLQuerymake= "SELECT * FROM tbl_photography where picID= " & strItemID & ""
set rs_pics=objconn.execute(SQLQuerymake)

      arrProducts(i,1)= rs_pics("picID")      
      arrProducts(i,2)= rs_pics("price_a3")
 arrProducts(i,3)= rs_pics("small_photo")      
      i = i + 1
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?

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.

change to
SQLQuerymake= "SELECT * FROM tbl_photography where picID= '" & strItemID & "'"
if txt_itemID data type is text or not an integer then my above code should work.
you should wrap the text with '
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 =-
Bootstrap 4: Exploring New Features

Learn how to use and navigate the new features included in Bootstrap 4, the most popular HTML, CSS, and JavaScript framework for developing responsive, mobile-first websites.

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

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?
rabbits2Author Commented:
180 is the individual item price, but I had selected 2
Like I said, "you never assign a value to iProductID, but you use it as integer.  That would cause error."
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 =-
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
put all the values in session variables, add new in each page, rather than passing through pages.
rabbits2Author Commented:
ok will give it a go. Thanks
Forced accept.

EE Admin
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

From novice to tech pro — start learning today.