how do you compare two strings

Discussion in 'ASP General' started by Peter, Sep 24, 2003.

  1. Peter

    Peter Guest

    Hi,

    I was wondering how do you compare variables that contain text strings in
    ASP.

    When I use the following If.. Then statement:

    If Rs("StyleNo") <> arrStyleNo(aCount) Then


    I always get the following error when I try to browse the page:

    Error Type:
    (0x80020009)
    Exception occurred.


    Thanks.

    Peter
    Peter, Sep 24, 2003
    #1
    1. Advertising

  2. Peter

    Ray at Guest

    Try:

    If CStr(Rs.Fields.Item("StyleNo").Value) = CStr(arrStyleNo(aCount))

    The CStr may be overkill, depending on what's in your array.

    But to answer your subject line, the StrComp function is what is used in VB
    Script for comparing two strings.
    http://msdn.microsoft.com/library/en-us/script56/html/vsfctstrcomp.asp

    Ray at home


    "Peter" <> wrote in message
    news:bkr1bo$...
    > I was wondering how do you compare variables that contain text strings in
    > ASP.
    >
    > When I use the following If.. Then statement:
    >
    > If Rs("StyleNo") <> arrStyleNo(aCount) Then
    >
    >
    > I always get the following error when I try to browse the page:
    >
    > Error Type:
    > (0x80020009)
    > Exception occurred.
    >
    >
    Ray at, Sep 24, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. GenxLogic
    Replies:
    3
    Views:
    1,242
    andrewmcdonagh
    Dec 6, 2006
  2. Neroku
    Replies:
    12
    Views:
    545
    Oliver Wong
    Feb 12, 2007
  3. Ben

    Strings, Strings and Damned Strings

    Ben, Jun 22, 2006, in forum: C Programming
    Replies:
    14
    Views:
    735
    Malcolm
    Jun 24, 2006
  4. Replies:
    9
    Views:
    534
    Stefan Ram
    Jul 29, 2008
  5. whisher

    Compare two strings .........

    whisher, Dec 10, 2006, in forum: Javascript
    Replies:
    3
    Views:
    98
    Dr J R Stockton
    Dec 10, 2006
Loading...

Share This Page