Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



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

Posts: 26
Location: SOuth Africa
Trades: 0
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!
 
 
Register now for full access!
Old 10-01-2004, 01:00 PM
kisk's Avatar
Extreme Talker

Posts: 161
Location: skynet
Trades: 0
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, 03:40 AM Request Form Height
frik's Avatar
Average Talker

Posts: 26
Location: SOuth Africa
Trades: 0
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, 08:22 AM
Minaki's Avatar
Defies a Status

Posts: 1,626
Location: Guildford, UK
Trades: 0
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!"

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
Minaki is offline
Reply With Quote
View Public Profile Visit Minaki's homepage!
 
Reply     « Reply to Type Mismatch
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB 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.48869 seconds with 12 queries