[thelist] ASP Question: If there is nothing to pull from the database...

Scott Schrantz scotts at rci-nv.com
Thu Dec 27 16:13:05 CST 2001


> -----Original Message-----
> From: Michele Foster [mailto:michele at wordpro.on.ca]
>
> Hey Josh,
> 
> Is there an advantage to using your approach as opposed to 
> the one Paul
> suggested, which was
> 
> "If objRS.Eof AND objRS.Bof Then"
> 
> Personally, I use Paul's approach .. but I'm always eager to learn
> new/better ways to doing things if they exist. 
> What do others do/prefer ?

	This depends entirely on the query you use and your database
structure. If your database has a tblComments and your query is "SELECT *
FROM tblComments WHERE ArticleID = 5;", then your recordset will have only
comments in it. And, if there are no comments, objRS.EOF wil be True.
	If, though, you have a simpler database structure, where there is a
tblArticles and the comments are stored in one of the fields, then you'll
want to use Josh's method. Your recordset won't be empty; there will still
be the Title and Author and the text of the article in the recordset, so
objRS.EOF would be False. But, the comments field would be empty. Then
Josh's method will just check the one field, rather than the whole
recordset.
	Josh's method depends on the database you are using, too. Some
databases (like MS Access) store empty text fields as a Zero-Length String,
not Null. IsNull would return False, so instead you'd have to use:  If
rs("Comments") = "" Then....





More information about the thelist mailing list