I have looked at many examples of how to execute SQL commands within a macro, but can’t get this to work.
It throws a:
BASIC runtime error.
An exception occurred
Type: com.sun.star.sdbc.SQLException
Message: Wrong data type: java.lang.IllegalArgumentException
Below is the code:
'create "connection and sql statement" to allow sql commands to be executed
DIM oStatement AS OBJECT
DIM sSQL AS STRING
oStatement = oForm.ActiveConnection.createStatement() 'Create an SQL statement object
'create, and format SQL INSERT command with "variables" as VALUES
sSQL = "INSERT INTO ""tbl_TREATMENTS"" (""fromWELLS_ID"", ""treatment_record"", ""record_date"", ""serviced_by_name"") VALUES ('" & stIDvalue & "', '" & stRemarksValue & "', '" & stDateValue & "', '" & stProvidersValue & "')"
PRINT sSQL
oStatement.ExecuteUpdate(sSQL) <----- this line generates the error
Any ideas? Is it a SQL formatting issue?
My variables all contain, and print their contents correctly.
Help, and thanks in advance.
Edit info [Opaque]: Put code into preformatted text