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.

The Database Forum


You are currently viewing our The Database Forum as a guest. Please register to participate.
Login



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

Posts: 74
Trades: 0
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
 
 
Register now for full access!
Old 07-25-2007, 06:44 PM Re: How to compare strings from SQL db...
ForrestCroce's Avatar
Half Man, Half Amazing

Posts: 3,023
Name: Forrest Croce
Location: Seattle, WA
Trades: 0
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 ...
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
ForrestCroce is offline
Reply With Quote
View Public Profile Visit ForrestCroce's homepage!
 
Old 07-25-2007, 09:41 PM Re: How to compare strings from SQL db...
webgrrl's Avatar
Skilled Talker

Posts: 74
Trades: 0
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 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.11862 seconds with 12 queries