I use ODBC and the MS Access dirver to connect to a database. I execute a "SELECT" query with SQLExecute. How can I know the number of rows selected ?
SQLRowCount cannot be used with SELECT.
Posted on 2002-08-30 14:51:26 by greenant
The number of rows selected is supplied by the actual database interface, and not SQL. I am not sure what are you using. Is it ADO, DAO, or ODBC directly?
Posted on 2002-08-30 16:21:35 by comrade
ODBC directly
Posted on 2002-08-31 02:07:36 by greenant
Use ADO. You can specify an ODBC connection, and it keeps all sorts of good information, like row count, etc. Alternatively, do a SELECT COUNT(*)..... before your main select, just to find out how many records will be returned.
Posted on 2002-08-31 07:50:42 by sluggy
I learnt odbc from Iczelion Tutorial and i don't know ADO or DAO. Can you suggest me some tutorials?
Posted on 2002-09-01 03:57:16 by greenant
There is an ADO example on Icz's site, right here.. Also, i believe one or two of the main guys in this forum (Ernie maybe?) have examples on there personal web sites.

To find out about using ADO in general, there are billions of tutorials on the net, including lots on the MS site of using ADO with VB. It may pay to take the time to check it out, because the extra power it will give you will be awesome.
Posted on 2002-09-01 04:37:37 by sluggy
To use ADO i must know COM. I read the docs in \masm32\com\docs.
I don't want to know how to use ADO because i have a friend that can teach me but i want to know how can i start using ADO,
i.e. how can i create the Recordset and the Connection object.
So i have to call CoCreateInstance, ..... ( what ?? )

I don't want to use third part library because i'm writing an application under GNU Gpl.
In AdoAsm there isn't the source code so i cannot know how it uses ADO

Thanks
Posted on 2002-09-02 10:54:16 by greenant
Don't use Access? *hides* :)
Posted on 2002-09-02 11:48:17 by bazik
Hi greenant,
Here's a quick & dirty modification to Iczelion's
ODBC example. It shows how to use the SQL Count Aggregate
Function to return row count.

Hope it will work for.
Posted on 2002-09-02 15:36:45 by Wayne
Bazik :
What do you mean with "Don't use Access? *hides* "

-------------
I'm writing a frontend for Mame. It have to run on any Pc with Windows 32bit and IE 4.01+ and no other software. I decided to use an Access database to store all the games information because it's easy to create an Access Database and every one that has Windows has the ODBC driver for Access. Since the list has about 3450 rows and 15 columns i use a progress bar in my "Wait ... Database is loading" dialogbox but i have to set the range of the progressbar before loading the list.
I could use SELECT COUNT but my select statement is this :
SELECT * FROM main WHERE ( Status = ? OR Status = ? OR Status = ? OR Status = ?) AND ( RomName LIKE ? ) AND ( Manufacturer LIKE ? ) AND ( Year BETWEEN ? AND ? ) AND ( Palette BETWEEN ? AND ? ) AND ( Resolution BETWEEN ? AND ? ) AND (Frequency BETWEEN ? AND ? ) ORDER BY RomName ASC
and in the future i will and almost 10 parameters.
If i used the SELECT COUNT statement I would have to prepare a select count statement, bind all the parameters and execute it : it will take long.

With ADO can I prepare statements ?
I looked for the ADOConnection interface in the adoint.h file but it inherits from Connection15 that inherits form ADO that inherits form IDispatch ....
Are there some inc files with ADO interfaces for masm32?

Thanks
Posted on 2002-09-03 11:33:33 by greenant
greenant,
i can understand your apprehension about using ADO, it can look scary. But like i said, if you take the time to learn (some of) it, then it will more than pay off for you. Don't worry to much about understanding the low level stuff, when you call CoCreateInstance just think of it as creating an object.

Alternatively, if you check out the ANSI SQL standard, i am pretty sure that you can actually include the COUNT() statement in your main sql, so it will look something like this:



SELECT
COUNT(*),
blah1,
blah2,
etc...
FROM
yourTable,
etc....
Posted on 2002-09-03 17:46:13 by sluggy