I read in the manual that the recordcount value for sql database recordset does not work
for other kind of db this properties works fine
this is a problem because it forces you to make a previous query that returns the number of records of real query
for the future is provided for the correction of this anomaly ??
And even Movefirst, moveprevious and movelast will not work.
It’s not xojo, but the database-engine / driver. You have to check per database you use.
For recordcount you can easily use a Select count(*) query.
ok "select count(*) " is another query , 2 query for the same work … (this employ double time)
then , database engine driver comes from xojo or somewhere her partner …
@Jury Buono - there are many different kind of databases and low level drivers are not made by xojo or whatever programming language provider you name. Just make a choice and work according the documentation of the selected database.
Xojo (the language) makes as much of the database functionality the same across all databases engines it supports. Unfortunately not all database engines support all the same functionality. Sometimes you have to work around the limitations with writing your own code. I am not an expert on SQL Server nor the SQL Server driver inside of Xojo, but I know there are some limitations around recordsets and moving (forward/back/first/last). The limit is coming from the Microsoft supplied Driver.
Do note that all the mentioned functions… MoveFirst, MoveLast, MoveNext and RecordCount all work just fine with SQLite
but as noted other Database engines may not support all of the , most notably, MoveFirst, MovePrevious and RecordCount, as some database engines only support a forward moving Cursor.
The Language Reference provides information of these limitations.
FWIW, I have been happily and reliably using RecordRount, MoveFirst, MoveNext and MoveLast with MSSQL.
The key to my positive experience probably resides in the fact that I use ADODB instead of ODBC. I have been using these features with databases residing on a MSSQL Express server, a “full fledged” server, and MSSQL on Linux as well. (this one is still beta). I confirm these features to work on MSSQL 2005, 2008, 2012 using ADODB connexions.
Using ADODB has a major drawback, however: this connexion mode is only available to clients running on Windows. So, my apps are not currently multi-client. My latest project needs to be cross-platform, including the server part. I will be using Postgre for this new project.
movefirst is not really needed as you are on the first record after the sqlselect to the recordset.
then you can have a do…loop until rs.eof and count the records in the loop
and no need for two queries.