Reply
How to compare strings from SQL db...
Old 07-25-2007, 02:39 PM How to compare strings from SQL db...
webgrrl's Avatar
Skilled Talker

Posts: 71
Okay, so I have some strings in a SQL db. I can display these just fine, using
objRSParks("ParkLink")

or by assigning this to a variable and the calling the variable, like so:
varDisplayPark = objRSParks("ParkLink")
Response.Write varDisplayPark


What I can't figure out is how to do comparisons with the variables. When I try this, it doesn't work:
If varDisplayPark = "central Park" Then
Response.Write "This is central park"
End If


I've tried changing the datatypes in the SQL database itself....I've tried text, varchar, char....

Is this a datatype problem, or something else?

Thanks,
WebGrrl
webgrrl is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 07-25-2007, 05:44 PM Re: How to compare strings from SQL db...
ForrestCroce's Avatar
Half Man, Half Amazing

Posts: 3,024
Name: Forrest Croce
Location: Seattle, WA
No, all those SQL data types translate to asp strings. Use whichever is most appropriate for your data ... probably varchar.

In ASP, your comparisons are case sensitive. Try something more like:

If lCase(Trim(objRSParks("ParkLink"))) = "central park" Then ...
ForrestCroce is offline
Reply With Quote
View Public Profile Visit ForrestCroce's homepage!
 
Old 07-25-2007, 08:41 PM Re: How to compare strings from SQL db...
webgrrl's Avatar
Skilled Talker

Posts: 71
Awesome, that worked beautifully. You rock...

Thanks,
WebGrrl
webgrrl is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to How to compare strings from SQL db...
 

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