Reply
Type Mismatch
Old 10-01-2004, 11:29 AM Type Mismatch
frik's Avatar
Average Talker

Posts: 26
Location: SOuth Africa
I have the following code :

Dim heigh
heigh = Request.Form("height")
heigh = Right(heigh, 5)

This return 1.75m

if heigh > 3 then
'Len(Request.Form("height")) > 3 Then

I subsitute If Len(Request.Form("height")) > 3 Then
with the following code
if heigh > 3 then

When I run the code I get the following errors:
Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch: '[string: "1.70m"]'
/VipModels/searcher1A.asp, line 67

Thank you for your help
frik is offline
Reply With Quote
View Public Profile Visit frik's homepage!
 
When You Register, These Ads Go Away!
Old 10-01-2004, 12:00 PM
kisk's Avatar
Extreme Talker

Posts: 161
Location: skynet
height is an integer or float isn't it?

If I'm not mistaken, Right() is a string function which takes the right side of a string... why are you trying to get the 5 right characters?


__________________________
Funny Shirts
kisk is offline
Reply With Quote
View Public Profile Visit kisk's homepage!
 
Old 10-04-2004, 02:40 AM Request Form Height
frik's Avatar
Average Talker

Posts: 26
Location: SOuth Africa
The string being send from the request form is 5'5" or 1.65m. The reason why we have it in feet an meters is that some of our overseas clients only work in feet an local clients (South African) clients work in meters. So we need to have both height measures on. I do encounter probelms when I work in feet, because if I do my select staement I encounter problems because the select clause ends after the 5'. So we decided to send the string to the database in meters. But when I select in meters i get the error message as seen in my original request
frik is offline
Reply With Quote
View Public Profile Visit frik's homepage!
 
Old 10-04-2004, 07:22 AM
Minaki's Avatar
Defies a Status

Posts: 1,626
Location: Guildford, UK
1.75m is a string, as it has the letter m in it. When you say:

if heigh > 3 then

you are comparing a string value (heigh) to an integer value (3), which causes the error.
What you could do is first take the m out:

heigh = Left(heigh, Len(heigh) - 1)

Which will return:

1.75

Then use Int() to convert it to an integer value:

if Int(heigh) > 3 then

(This is, assuming you want to tell if the height is higher than 3 meters?)
__________________
Minaki Serinde MCP
"Wow, Linux is nearly on-par with Windows ME!"
Inoxia Pyrotechnics Supplies | Surrey Angels Cheerleading Squad
Minaki is offline
Reply With Quote
View Public Profile Visit Minaki's homepage!
 
Reply     « Reply to Type Mismatch
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.11541 seconds with 12 queries