[thelist] Simple string comparison -- plz help

Ken Schaefer Ken at adOpenStatic.com
Wed Jan 19 17:17:32 CST 2005


As mentioned by others, the problem is being caused by your use of Char(10)
field (which will pad all values to 10 characters). VarChar(10) should be
used for variable length fields where you don't want padding.

As an aside, using code like:

<%
If Len(myVariable) >= 1 then

	For i = 1 to Len(myVariable)

		Response.Write(Asc(Mid(myVariable, i, 1)) & "<br />" &
vbCrLf)

	Next

Else

	Response.Write("no length")

End If
%>

will write out all the values in your string (one ACSII value per line), and
help you check a value, including outputting any
hidden/nonprintable/whitespace characters.

Cheers
Ken

: -----Original Message-----
: From: thelist-bounces at lists.evolt.org
[mailto:thelist-bounces at lists.evolt.org] On
: Behalf Of Brian Delaney
: Sent: Thursday, 20 January 2005 7:36 AM
: To: thelist at lists.evolt.org
: Subject: [thelist] Simple string comparison -- plz help
: 
: I am pulling a field from sql that contains a Y or  a N value.
: 
: In my asp code I do the following:
: 
: vAnswer = rsStuff("YorN")
: 
: if vAnswer = "Y" Then
:      do something
: else
:      do something else
: end if
: 
: It never hits a match and always falls to the else. I am sure since I am
: a newbie it has to do with string or char conversion.
: 
:  In sql YorN  is defined as a char, 10 allow NULL. There is either a N
: or Y in the field.
: 
: thanks
: 
: BD
: 
: 
: 
: *
: *
: *
: This message, including any attachments, is intended solely for the use of
the
: named recipient(s) and may contain confidential and/or priveleged
information.
: Any unauthorized review, use, disclosure or distribution of this
communication(s) is
: expressly prohibited.  If you are not the intended recipient, please
contact the
: sender by reply e-mail and destroy any and all copies of the original
message.
: --
: 
: * * Please support the community that supports you.  * *
: http://evolt.org/help_support_evolt/
: 
: For unsubscribe and other options, including the Tip Harvester
: and archives of thelist go to: http://lists.evolt.org
: Workers of the Web, evolt !


More information about the thelist mailing list