Reply
Feet and Inches
Old 10-01-2004, 08:32 AM Feet and Inches
frik's Avatar
Average Talker

Posts: 26
Location: SOuth Africa
On my database I have a height column and the values are in feet and inches eg 5'10". When a new value is send to the database it is accepted an written to the database. When I want to retrieve this value from the databse i do encounter problems

strWhereClause = strWhereClause & " height LIKE '" & Request.Form("height") & "%'"

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'height LIKE '5' 5"%''.

How Can I rectify it ?

Your help is appreciatexd
frik is offline
Reply With Quote
View Public Profile Visit frik's homepage!
 
When You Register, These Ads Go Away!
Old 10-01-2004, 08:19 PM
vivekar's Avatar
Webmaster Talker

Posts: 539
When inserting quoted information, you should use 2 single quotes and 2 double quotes.

like 5'' 3"".
That's the escape chars.

dim h

h = CheckString(Trim(Request.Form("height")))
-----------
Function CheckString(string)
if string = "" then string = " "
CheckString = Replace(string, "'", "''")
CheckString = Replace(string, """, """")
End Function
-----------

Now use the sql statement.
__________________
| Submit URL at All the Websites Directory
| Get Certified in Web Design
vivekar is offline
Reply With Quote
View Public Profile Visit vivekar's homepage!
 
Reply     « Reply to Feet and Inches
 

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