Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to search for a record?

Status
Not open for further replies.

bomayed

Technical User
May 13, 2002
101
AE
I want to :

[ Select * From table ]

and I want to tell the script this condition :

[ IF "field! was not fond in the record" THEN ]

do something

[ END IF ]


can someone tell me how can this be done in ASP ?

thank you all
 
set rs = cn.execute("select * from myTable where fieldName = 'field value'")

if rs.eof then
'record was not found
else
'record was found
end if

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook
 
Thanks mwolf00 , but I want to do :

[ SELECT * FROM TABLE ]

I don't want to use a where clause . . :(

 
Then you'll have to loop through the results...

set rs = cn.execute("select * from myTable")

valFound = false
do while not rs.eof
if rs("fieldName") = "some value" then
valFound = true
exit do
enf if
rs.movenext
loop

if valFound then
'handle here
end if

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook
 
Are you trying to search for a particular column name, rather than the data contained within it?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top