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;