The code below to access a MySQL table used to work when I first created it. Now however it bombs out to my error handler when it attempts to do the execute statement (earlier in the code there is “ON ERROR GOTO Cancelled” statement). The database connection is established earlier in the macro and it works because it executes an SQL statement for me and returns the correct result.
My suspicion is that I am failing to intialise something correctly, but I cannot see what that might be. When I stepped through the code when it was working, it executed exactly as expected, so I’m needing some pointers to debug the problem.
The intended function of the macro is to parse a text file which contains data which is then written into my database table, line by line.
If more information is required I can post the whole of the macro, but at this stage I would like to try and resolve the problem myself, with the forum’s guidance to help me through it. That way I’ll learn better!
The environment is Libre Office 7.1.7.2 running under Windows 11 (doesn’t work with W10 either). The database is MySQL 8.0 CE running as localhost on the pc.
Looking forward to your thoughts as I have not had any joy via Google searches.
Thank you.
oRS=createUnoService(“com.sun.star.sdb.RowSet”)
With
oRS.DataSourceName=DBName
oRS.CommandType=0 ' table
oRS.Command= InTable
oRS.IgnoreResult=TRUE
oRS.execute()
End With