954,566 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Type mismatch

dim num, GOPercent

num = Request.Cookies("Result")

GOPercent = num/25 Type mismatch: '[string: ""]'

Error Type mismatch. But the value i put in Response.cookies("Result") is a CInt(value)

how to solve this ?????

k_en
Light Poster
35 posts since Jul 2005
Reputation Points: 13
Solved Threads: 0
 

I'm not sure if you're saying the value you get from num = Request.Cookies("Result") is blank or just that it is a mismatch.

First of all do the following to your code

num = Request.Cookies("Result")

If num <> "" Then

GOPercent = cInt(num)/25

End If


If you are saying you get no value back then check two things

1. You are definately setting Response("Result") to a value

2. Cookies are enabled on the client browser

You are going to need a lot more durable code to run this kind of thing so look in to how to preempt errors and handle issues. This isn't as easy in vbscript as it is in other languages, but there's always a way :)

davidcairns
Junior Poster
114 posts since Feb 2007
Reputation Points: 12
Solved Threads: 8
 

Thanks.....Solve

k_en
Light Poster
35 posts since Jul 2005
Reputation Points: 13
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You