Skip to Content
author's profile photo Former Member
Former Member

XSJS: Insert Into does not create a record in table

Hey guys its me again,

i created a xsjs function which should insert a singel record to a given table, my cuurent code looks like below.

function insertRecordsIntoTable(schemas,tables,fields,values){
// Set action
var statement = "INSERT INTO "; // specify target table var target = "\""+schemas[0]+"\".\""+tables[0]+"\" ";
statement = statement.concat(target); var index; // Build column part
var columns = "(";
columns = columns.concat(fields[index]+","); } // Build value part
var vals = " VALUES (";
vals = vals.concat("?,");
} // Concat tails to builded Strings
vals = vals.concat("?)");
columns = columns.concat(fields[fields.length-1]+")"); // Concat to final statement statement = statement.concat(columns);
statement = statement.concat(vals); try{
var conn = $.db.getConnection();
var pstmt =conn.prepareStatement(statement); // Replace placeholder with final values concerning sql injection for(index=0;index<values.length;index++){
} pstmt.execute();
return true;
return e;

When i run it, everything seems fine but if i take a look at the target table no data record is created and i have no clue why this happens.

Does anyone have a suggestions or had the same problem?

Edit: I tried following statements:



and of course raw values.

Thank you for your answers in advance :-)

Best Regards,


Message was edited by: Lukas Kaeser

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    Posted on Aug 19, 2015 at 09:40 AM

    Hello Lukas,

    do a commit.


    Best Regards,


    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.