Unix Technical Forum

SQL_CALC_FOUND_ROWS using ODBC driver

This is a discussion on SQL_CALC_FOUND_ROWS using ODBC driver within the MySQL General forum forums, part of the MySQL category; --> Hi, I've used PHP with MySQL and I was able to count the rows of a table by using ...


Go Back   Unix Technical Forum > Database Server Software > MySQL > MySQL General forum

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-28-2008, 05:48 AM
Nuno Oliveira
 
Posts: n/a
Default SQL_CALC_FOUND_ROWS using ODBC driver

Hi,

I've used PHP with MySQL and I was able to count the rows of a table by
using the following code:

SELECT SQL_CALC_FOUND_ROWS * FROM MyTableName;
SELECT FOUND_ROWS();

However, I would like to do the same thing using Visual Basic 6...

When I set the RS.Source to the first SELECT statement and open it, it
run OK but I need to close the RS and open it again using the second
SELECT statement.

After any of this operations I get a Recordset->RecordsCount = 1

How can I work this out?

Thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-28-2008, 05:48 AM
Nils Meyer
 
Posts: n/a
Default Re: SQL_CALC_FOUND_ROWS using ODBC driver

Hi,

Nuno Oliveira wrote:
> When I set the RS.Source to the first SELECT statement and open it, it
> run OK but I need to close the RS and open it again using the second
> SELECT statement.
>
> After any of this operations I get a Recordset->RecordsCount = 1


That is actually a correct figure, SELECT FOUND_ROWS() returns exactly
one record *CONTAINING* the number of found rows. So you have to access
the resultset to get the actual number of rows. SELECT
SQL_CALC_FOUND_ROWS doesn't make much sense without a where clause by
the way.

regards
Nils
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 06:18 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com