Recordset ADO MySQL Win2003server -> recordcount = -1 always

Recordset ADO MySQL Win2003server -> recordcount = -1 always

Post by Neo » Fri, 14 May 2004 01:52:40


Opening a ADO recordset in my local computer which data are physically in a
MySQL database (in a Win2003 server at my company server), the recordcount
method always returns -1. How can I determine if the recordset opened isn
empty, or when it has records.

Thanks

Neo.
 
 
 

Recordset ADO MySQL Win2003server -> recordcount = -1 always

Post by Jeff Johns » Fri, 14 May 2004 02:52:35


a
isn

Check the EOF property after opening the recordset.

 
 
 

Recordset ADO MySQL Win2003server -> recordcount = -1 always

Post by Qm9iIEtyaW » Fri, 14 May 2004 05:36:07

Just to warn you, you might also have to advance to the end of the recordset before the Record Count will be accurate

If it is a forward-only recordset, or one without a "flexible" cursor, then MoveLast may not work; and you will have to advance a record at a time and check EOF each time to "find" the RecordCount

I don't know if ADO and MySql require this, but I know some combinations do
 
 
 

Recordset ADO MySQL Win2003server -> recordcount = -1 always

Post by Victor Koc » Fri, 14 May 2004 05:42:56

Hi Neo,

Check the BOF and EOF properties after opening the recordset,

Rs.Open "SELECT .................................
IF Rs.BOF and Rs.EOF then
MsgBox "Recordset is empty"
Else
MsgBox "Recordset is not empty"
End IF


"Neo" < XXXX@XXXXX.COM > escribien el mensaje
>> Opening a ADO recordset in my local computer which data are physically in
a >> MySQL database (in a Win2003 server at my company server), the recordcount >> method always returns -1. How can I determine if the recordset opened
isn >> empty, or when it has records. >> >> Thanks >> >> Neo. >> >> >>
 
 
 

Recordset ADO MySQL Win2003server -> recordcount = -1 always

Post by Zour » Fri, 14 May 2004 05:50:22

you could also try to set CursorLocation to adUseClient before opening the
recordset.

--
Best Regards
Yanick Lefebvre
 
 
 

Recordset ADO MySQL Win2003server -> recordcount = -1 always

Post by Neo » Sun, 16 May 2004 03:13:12

Thank Zoury, that solution was really good, I read it from the mysql website
yesterday, Conn.CursorLocation=adUseClient, and it works fine!



"Zoury" < XXXX@XXXXX.COM > escribien el mensaje
>> you could also try to set CursorLocation to adUseClient before opening the >> recordset. >> >> -- >> Best Regards >> Yanick Lefebvre >> >>
 
 
 

Recordset ADO MySQL Win2003server -> recordcount = -1 always

Post by Neo » Sun, 16 May 2004 03:14:47

Thanks friends, your pieces of advice really help me.

Regards,

Neo.

"Neo" < XXXX@XXXXX.COM > escribien el mensaje
>> Opening a ADO recordset in my local computer which data are physically in
a >> MySQL database (in a Win2003 server at my company server), the recordcount >> method always returns -1. How can I determine if the recordset opened
isn >> empty, or when it has records. >> >> Thanks >> >> Neo. >> >> >>