I have an application where I need to execute a SQL command from BASIC script. I found how to do it not long ago, but now I cannot find it.
From googles cached page of http://ooo-forums.apache.org/en/forum/viewtopic.php?t=42882&p=197875
REM make sure your connected to the database
if IsNull(ThisComponent.CurrentController.ActiveConnection) then
ThisComponent.CurrentController.connect
endif
REM execute!
Dim oStatement As Object
oStatement = ThisComponent.CurrentController.ActiveConnection.createStatement()
oStatement.execute("SOME SQL COMMAND")
In the latest LO I receive the error that “ActiveConnection” is an unknown property or method
Try this:
if IsNull(Thisdatabasedocument.CurrentController.ActiveConnection) then
Thisdatabasedocument.CurrentController.connect
endif