Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Checking a value of a recordset and seeing if a queried string valueexists

Reply
Thread Tools

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

 
 
.Net Sports
Guest
Posts: n/a
 
      07-28-2009
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
 
Reply With Quote
 
 
 
 
Bob Barrows
Guest
Posts: n/a
 
      07-28-2009
..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


 
Reply With Quote
 
 
 
 
.Net Sports
Guest
Posts: n/a
 
      07-28-2009
On Jul 28, 10:28*am, "Bob Barrows" <(E-Mail Removed)> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Decimal value setting problem (ASP & ADODB.Recordset value & MSSQLServer & 2003 Server) avcitamer ASP General 6 09-18-2008 03:10 PM
windows authentication and putting queried data into session state nem.usenet@gmail.com ASP .Net 1 03-19-2007 11:39 PM
How to get the total number of queried records? Quentin Huo ASP .Net 5 09-01-2004 10:53 PM
RecordSet.Move or RecordSet.AbsolutePosition?? Hung Huynh ASP General 8 09-24-2003 11:07 AM



Advertisments