Hey Gang!
Would someone kindly help me understand this little problem:
More stuff like database query goes here
At the If u3 > 0 Then... statement just above I get a type mismatch '[string: ""]'
The rules enforced on the form side is that either the u1 or u2 fields must have a number greater than 0 and only if u2 is greater than 0 can u3 - u16 possibly have a numeric value and then only one of u3-u16 can have a numeric value.
The question is why am I getting a type mismatch when comparing a null (according to the error message) value against zero (of course I know that Null and Zero are different but how do you cast against this?)?
Would someone kindly help me understand this little problem:
Code:
'See if this is a single system purchase
u1 = Trim(Request.Form("q1"))
If u1 = 0 Then
'If we got here, we are looking for quantity purchases
u2 = Trim(Request.Form("q2")) 'This would be the starter pak
If u2 = 0 Then
'If q2 is empty we failed our form validation or this is a bogus submit
Response.Redirect("/purchase")
Else
u3 = Trim(Request.Form("q3"))
u4 = Trim(Request.Form("q4"))
u5 = Trim(Request.Form("q5"))
u6 = Trim(Request.Form("q6"))
u7 = Trim(Request.Form("q7"))
u8 = Trim(Request.Form("q8"))
u9 = Trim(Request.Form("q9"))
u10 = Trim(Request.Form("q10"))
u11 = Trim(Request.Form("q11"))
u12 = Trim(Request.Form("q12"))
u13 = Trim(Request.Form("q13"))
u14 = Trim(Request.Form("q14"))
u15 = Trim(Request.Form("q15"))
u16 = Trim(Request.Form("q16"))
End If
End If
Code:
If u1 > 0 Then
Response.Write("<tr><td>" &prodRows(P_num, 0) &"</td><td>" &prodRows(P_desc, 0) &"</td><td>" &prodRows(P_price, 0) &"</td><td>" &u1 &"</td></tr>")
nTotal = prodRows(P_price, 0) * u1
Else
Response.Write("<tr><td>" &prodRows(P_num, 1) &"</td><td>" &prodRows(P_desc, 1) &"</td><td>" &prodRows(P_price, 1) &"</td><td>" &u1 &"</td></tr>")
nTotal = prodRows(P_price, 1) * u2
Response.Write("Sub total: " &nTotal &"<br>")
End If
If u3 > 0 Then
Response.Write("<tr><td>" &prodRows(P_num, 2) &"</td><td>" &prodRows(P_desc, 2) &"</td><td>" &prodRows(P_price, 2) &"</td><td>" &u1 &"</td></tr>")
nTotal = nTotal + prodRows(P_price, 2) * u3
Response.Write("Sub total: " &nTotal)
End If
At the If u3 > 0 Then... statement just above I get a type mismatch '[string: ""]'
The rules enforced on the form side is that either the u1 or u2 fields must have a number greater than 0 and only if u2 is greater than 0 can u3 - u16 possibly have a numeric value and then only one of u3-u16 can have a numeric value.
The question is why am I getting a type mismatch when comparing a null (according to the error message) value against zero (of course I know that Null and Zero are different but how do you cast against this?)?