Checking a value of a recordset and seeing if a queried string valueexists

Discussion in 'ASP General' started by .Net Sports, Jul 28, 2009.

  1. .Net Sports

    .Net Sports Guest

    I have a field that is a char datatype in sql, and I need to see if
    that field contains a letter that I am passing thru a querystring.
    "rscatd" is my recordset/results, request.querystring("myquery") is
    the request object. My If statement needs to be something similar to
    an sql statement :

    if rscatd("mycolumn") NOT like '%" & myquery & "%' then
    'process a task

    ...but i can't find an asp string function that checks inside the
    string value (instr only checks for position, split breaks up strings
    into arrays...)

    ???
    NS
     
    .Net Sports, Jul 28, 2009
    #1
    1. Advertising

  2. .Net Sports

    Bob Barrows Guest

    Re: Checking a value of a recordset and seeing if a queried string value exists

    ..Net Sports wrote:
    > I have a field that is a char datatype in sql, and I need to see if
    > that field contains a letter that I am passing thru a querystring.
    > "rscatd" is my recordset/results, request.querystring("myquery") is
    > the request object. My If statement needs to be something similar to
    > an sql statement :
    >
    > if rscatd("mycolumn") NOT like '%" & myquery & "%' then
    > 'process a task
    >
    > ..but i can't find an asp string function that checks inside the
    > string value (instr only checks for position, split breaks up strings
    > into arrays...)


    Checking for position is exactly what you want to do. If the string is
    not found, Instr() returns 0.

    Are you processing multiple records? Or are you simply trying to
    determine if a record exists that contains that string? If so, you can
    make your life a lot simpler. Let me know if you want me to go into more
    detail.

    --
    HTH,
    Bob Barrows
     
    Bob Barrows, Jul 28, 2009
    #2
    1. Advertising

  3. .Net Sports

    .Net Sports Guest

    Re: Checking a value of a recordset and seeing if a queried stringvalue exists

    On Jul 28, 10:28 am, "Bob Barrows" <> wrote:
    > .Net Sports wrote:
    > > I have a field that is a char  datatype in sql, and I need to see if
    > > that field contains a letter that I am passing thru a querystring.
    > > "rscatd" is my recordset/results, request.querystring("myquery") is
    > > the request object. My If statement needs to be something similar to
    > > an sql statement :

    >
    > > if rscatd("mycolumn") NOT like '%" & myquery & "%' then
    > > 'process a task

    >
    > > ..but  i can't find an asp string function that checks inside the
    > > string  value (instr only checks for position, split breaks up strings
    > > into arrays...)

    >
    > Checking for position is exactly what you want to do. If the string is
    > not found, Instr() returns 0.
    >
    > Are you processing multiple records? Or are you simply trying to
    > determine if a record exists that contains that string? If so, you can
    > make your life a lot simpler. Let me know if you want me to go into more
    > detail.
    >
    > --
    > HTH,
    > Bob Barrows


    Thanks for the responses. Now understanding that instr can return a
    value of 0 if empty, i was able to do some creative statements to make
    it work
     
    .Net Sports, Jul 28, 2009
    #3
    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. Quentin Huo
    Replies:
    5
    Views:
    538
    =?Utf-8?B?TWF0dCBIYW1pbHRvbg==?=
    Sep 1, 2004
  2. Replies:
    1
    Views:
    359
    Jeff T
    Mar 19, 2007
  3. Zach Wells

    UpdateCommand not seeing value

    Zach Wells, Apr 15, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    138
    Zach Wells
    Apr 15, 2004
  4. Hung Huynh
    Replies:
    8
    Views:
    349
    Bob Barrows
    Sep 24, 2003
  5. avcitamer
    Replies:
    6
    Views:
    226
    Bob Barrows [MVP]
    Sep 18, 2008
Loading...

Share This Page