Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.

Inserting multiple records into a database from a table


Former Community Member
I have a dynamic table with rows upto 10. i am trying to insert all the records in these rows into a database ( msaccess)

table name: Table1 ( in my form )

Database table : movies_comments ( as posted in stefan's forums ).

table columns: username, movieid, comments

i am using the following code.

Database.ExecSQL() function is as posted in stefcamerons forums.

var tlength = xfa.resolveNode("form1.#subform[0].Table1.Row1[*]").length;

xfa.host.messageBox("tlength is :" +tlength);

for ( var i = 1; i <= tlength; i++)


var username = xfa.resolveNode("form1.#subform[0].Table1.Row1["+i+"].user_name").rawValue;

var movieID = xfa.resolveNode("form1.#subform[0].Table1.Row1["+i+"].movie_id").rawValue;

var commentS = xfa.resolveNode("form1.#subform[0].Table1.Row1["+i+"].comment_").rawValue;

Database.ExecSQL("INSERT INTO movie_comments (username, movieId, comment) VALUES ('username','movieID', 'commentS');");


i am trying to insert multiple records using the code above. But i am getting error

GeneralError: Operation failed.


SOM expression returned list when single result was expected

suggest me an alternate way to insert multiple records from a table into a database.

thank Q
0 Replies