[thelist] ASP, SQL, Recordsets, Best Practices
Michele Foster
michele at wordpro.on.ca
Thu Mar 1 15:14:33 CST 2001
Thanks Rudy ...
Just wanted to confirm .. old code .. hacked out from the "first days of
learning ASP/database connections, etc.". It worked .. but wasn't
necessary, as I thought. I'll proudly wear the *dunce* cap tho. :)
From: "rudy" <r937 at interlog.com>
> IF "yes a record exists"
> [ do something ]
> ELSE
> [ do something else, perhaps nothing ]
Yes, that's what I want.
> >... when there can only be one
> > unique record (field doesn't allow duplicates) or no record at all.
>
> presumably you want to do something with the fields for this particular
> row? if you don't need to use any of the fields, i.e. if you only need to
> know *whether* a row exists, then you should be using
Yes, I need the one record to be displayed, but thanks for the tip below,
that'll come in handy for something else no doubt. :) [Actually, I already
have a use for it .. thanks.]
> select count(*) from [table] where [uniqueness]
>
> you'll get back a 0 or some positive number, and you can build the IF
> ELSE condition just by testing on zero
>
> count(*) is a lot quicker for the database, too -- no rows to access
More information about the thelist
mailing list