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

N

.Net Sports

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
 
B

Bob Barrows

..Net Sports said:
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.
 
N

.Net Sports

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.

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,765
Messages
2,569,568
Members
45,042
Latest member
icassiem

Latest Threads

Top