string compare

Results 1 to 3 of 3

Thread: string compare

  1. #1
    Join Date
    Dec 1969

    Default string compare

    I have a string field in the database with the value "No", when i compare with another same string get nothing, codes shown below.<BR><BR>if Rs("strExpireDate")="No" then<BR>Response.Write("its No")<BR>end if<BR><BR>The response.write does not print anything even the condition is true.<BR><BR>any idea?

  2. #2
    Join Date
    Dec 1969

    Default I disagree

    If it prints nothing, then the condition isn&#039;t true. By definition.<BR><BR>What you&#039;re asking is whether the data in the recordset exactly matches the string "No". It doesn&#039;t look that way. Try this:<BR><BR>[code language="VBScript"]If Trim(LCase(Rs("strExpireDate") & "")) = "no" Then<BR> Response.Write "it&#039;s No (or similar)"<BR> Response.Flush<BR>End If[/code]<BR><BR>Craig.

  3. #3
    Join Date
    Dec 1969

    Default Is it Access and a Yes/No field?

    If so, you have to check for True/False:<BR><BR>If rs("strExpireDate") = True Then<BR>&#039;blah<BR>End If<BR><BR>Otherwise, do some debugging:<BR>Response.Write "Rs(""strExpireDate"") = " & Rs("strExpireDate") & "&#060;br /&#062;"<BR>Response.Write "(Rs(""strExpireDate"") = No) = " & (Rs("strExpireDate") = "No") & "&#060;br /&#062;"<BR><BR>What do you see/get?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts