Joined: 19 Nov 2006
|Posted: Sun Nov 19, 2006 3:40 am Post subject: Why the ResultSet doesn't load all records in a SQL table?
I'm trying to import data from a MySQL database in a Calc sheet using a macro; while doing this, the ResultSet that I create never contains all records that are in database's table and I don't know why. The code that I wrote is the following:
Dim DatabaseContext as Object
Dim DataSource as Object
Dim Connection As Object
Dim Statement As Object
Dim ResultSet As object
Const Costante1 = 1008
Const Costante2 = 1005
DatabaseContext = createUnoService("com.sun.star.sdb.DatabaseContext")
DataSource = createUnoService("com.sun.star.sdb.DataSource")
Connection = DataSource.getConnection("my_user","my_pwd")
Statement = Connection.createStatement()
Statement.ResultSetConcurrency = Costante1
Statement.ResultSetType = Costante2
ResultSet = Statement.executeQuery("select * from my_table_name")
The ResultSet created have always less rows than expected; the sintax should be correct and the problem is not in the max number of rows in the Statement because the problem remains even this value is changed. Also the connection works good. May it be a problem of compatibility between different versions of sofware? I'm using MySQL 4.0.15 and the macro builder included in OpenOffice 2.0.
If anyone can solve this problem I'll be very gratefull. Thanks a lot to everybody will help!