sqlopenoffice.orgopenoffice-calcopenoffice-base

Execute SQL query from OpenOffice macro


I have an SQL query which I want to run when a button in my OpenOffice Calc worksheet is pressed. I've found out how to bind a macro to the button, but I can't get a connection to the database it seems (I've created an .odb file and I can run the query from within OpenOffice Base).

How do I tell OpenOffice Calc which connection to use and which query to execute?


Solution

  • Create a connection to the .odb file as in my answer here.

    Then perform a query using executeQuery() and getString() as shown here: https://wiki.openoffice.org/wiki/Documentation/BASIC_Guide/Database_Access