Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Trouble with SQL INSERT in macro in OOBase

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.

click to hide/show revision 2
None

Trouble with SQL INSERT in macro in OOBase

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

executed

DIM oStatement AS OBJECT DIM sSQL AS STRING

STRING

oStatement = oForm.ActiveConnection.createStatement() 'Create an SQL statement object

object

'create, and format SQL INSERT command with "variables" as VALUES

VALUES

sSQL = "INSERT INTO ""tbl_TREATMENTS"" (""fromWELLS_ID"", ""treatment_record"", ""record_date"", ""serviced_by_name"") VALUES ('" & stIDvalue & "', '" & stRemarksValue & "', '" & stDateValue & "', '" & stProvidersValue & "')"

PRINT sSQL

sSQL

oStatement.ExecuteUpdate(sSQL) <----- this line generates the error

error

Any ideas? Is it a SQL formatting issue?

My variables all contain, and print their contents correctly.

Help, and thanks in advance.

click to hide/show revision 3
None

Trouble with SQL INSERT in macro in OOBase

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 preformmatted text

click to hide/show revision 4
None

Trouble with SQL INSERT in macro in OOBase

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 preformmatted text

click to hide/show revision 5
None

Trouble with SQL INSERT in macro in OOBase

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.advance.

Edit info [Opaque]: Put code into preformmatted preformatted text