Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7577915
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:18:23+00:00 2026-05-30T17:18:23+00:00

How to execute an INSERT statement using a javascript ADODB.Recordset object? This is the

  • 0

How to execute an INSERT statement using a javascript ADODB.Recordset object?

This is the code I’m trying to run:

/* Getting access to the database */
var connection = new ActiveXObject("ADODB.Connection");
var connectionstring = "Data Source=srvp7rnd-herm;Initial Catalog=hermes;User ID=hermes;Password=hermes;Provider=SQLOLEDB";
connection.Open(connectionstring);

/* JavaScript obect to access a SQL query's results */
var rs = new ActiveXObject("ADODB.Recordset");

/* Getting the current MAX(id) from the database */
rs.Open("SELECT MAX(id) FROM Screen_Template", connection);
rs.MoveFirst;
var maxID = rs.Fields.Item(0);
maxID = maxID + 1;

/* TODO: Get the last UID */
var sql = "INSERT INTO Screen_Template(template_name, OpCo, env, template_xml, language, id, title, role, UID) VALUES (" + templateName + "," + opco + "," + env + "," + "<hello>hello</hello>" + ",eng," + maxID + ",Hermes SMS message composer," + "manag, 10)";
alert(sql);
rs.Open(sql, connection);

/* Closing the connections */
rs.close;
connection.close;

But when I’m trying to run that code it gives me an error message.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T17:18:24+00:00Added an answer on May 30, 2026 at 5:18 pm

    Please try with this code. If Screen_Template column type is Varchar, you have to append “‘” to your variables. If SQL statement from alert(sql) was correct format with your Table Schema, it should be okay. Hope this help.

       /* Getting access to the database */
        var connection = new ActiveXObject("ADODB.Connection");
        var connectionstring = "Data Source=srvp7rnd-herm;Initial Catalog=hermes;User ID=hermes;Password=hermes;Provider=SQLOLEDB";
        connection.Open(connectionstring);
    
        /* JavaScript obect to access a SQL query's results */
        var rs = new ActiveXObject("ADODB.Recordset");
    
        /* Getting the current MAX(id) from the database */
        rs.Open("SELECT MAX(id) FROM Screen_Template", connection);
        rs.MoveFirst;
        var maxID = rs.Fields.Item(0);
        maxID = maxID + 1;
        rs.close;
    
        /* TODO: Get the last UID */
        var sql = "INSERT INTO Screen_Template(template_name, OpCo, env, template_xml, language, id, title, role, UID) VALUES ('" + templateName + "','" + opco + "','" + env + "'," +"'<hello>hello</hello>'" + ",'eng'," + maxID + ",'Hermes SMS message composer'," + "'manag', 10)";
        alert(sql);
        rs.Open(sql, connection);
    
        /* Closing the connections */
        //rs.close;
        connection.close;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to execute an Insert statement, but keep getting a Invalid object name
I'm using this code in Python: for ... : cursor.execute('INSERT OR IGNORE INTO foo
I am trying to run an mysql sql statement using the code below; public
I am trying to execute a INSERT statement on a mySQL DB in C#:
I'm trying to execute a basic INSERT statement on a MySQL table from a
I'm using a prepared statement + execute batch in order to insert data into
I've managed to run this query using wamp. INSERT INTO guest (guestno,familyname) VALUES(NULL,'Damn'); INSERT
I execute an INSERT INTO statement cursor.execute(INSERT INTO mytable(height) VALUES(%s),(height)) and I want to
I have the following Python code: cursor.execute("INSERT INTO table VALUES var1, var2, var3,") where
I'm having some issues using mysqli to execute a script with SELECT,DELETE,INSERT and UPDATE

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.