Beanshell to connect to Base table
Posted: Thu May 21, 2020 4:12 pm
Hello,
I am trying to make a Beanshell macro in Base to connect to a table called schools. Here is my sample code:
I don't see any error, but it does not update. Can you please let me know what I am doing wrong?
I am trying to make a Beanshell macro in Base to connect to a table called schools. Here is my sample code:
Code: Select all
oDoc = UnoRuntime.queryInterface(XModel.class,XSCRIPTCONTEXT.getInvocationContext());
if ( oDoc == null )
oDoc = XSCRIPTCONTEXT.getDocument();
oConn = oDoc.getCurrentController().connect("","");
oStmt = oConn.createStatement();
oStmt.executeUpdate( "update ""schools"" set ""name""='Name of School' where ""ID""=1012" );
// BeanShell OpenOffice.org scripts should alsysways return 0
return 0;