Yes, it is better to use BOF and EOF. Using the RecordCount property forces
it to count how many records there is, which is very inefficient and could
take a long time. This could bog down your server or no good reason. You
don't care how many records there are, you just care if the RecordSet is
empty. It is also true that some providers don't support it.
The code below doesn't work if you have records and you're already at the
BOF or EOF. For example, you repeatedly go to the next record until EOF. In
this situation, BOF is False and EOF is True. The condition in the If
statement is False and so it executes the else clause "Recorset don't have
records", but actually the RecordSet does have records.
Code that functions in all situations and is slightly cleaner is:
If rs.BOF and rs.EOF Then
' RecordSet is empty
' RecordSet is not empty
"Victor Koch" <v i c t o r (arroba)correo(punto)waldbott(punto)com(punto)ar>
>>>> I have this really weird problem.
>>>> When I query a database with a string, which I know will return only one
>> record, by using an asp page, the recordcount object of the
>> has value 0. I do know that the sql query I use is ok, because I tested it
>> in my database app.
>>>> I use Windows 2003 server as the asp platform and I use mysql 4.0.18 ad
>> the database.
>>>> Please can anyone help me? It's dirving me crazy!