title: Insert into Access database using JavaScript
body: <p>Right now I'm studying JavaScript for our next semester. </p>
  
  <p>The problem is, I can't insert data in my database (MS Access). What is wrong or missing in the syntax?</p>
  
  <p>Note: I also tried the <code>+</code> instead of <code>&amp;</code>. Here is my code:</p>
  
  <pre><code>function register(){
      var fname = document.getElementById('fname').value;
      var lname = document.getElementById('lname').value;
      var usernn = document.getElementById('username').value;
      var passw = document.getElementById('password').value;
  
                      }
  
  var con = new ActiveXObject("ADODB.Connection");
  var constring = "Provider=Microsoft.Jet.OLEDB.12.0;Data Source = Z:\JavaScript Practice Code\jscript.accdb";
  var rset = new ActiveXObject("ADODB.Recordset");
         con.Open(constring);
  function register(){
  
  var sql = "Insert into register(fname,lname,usern,passw) Values('"&amp;fname&amp;"','"&amp;lname&amp;"','"&amp;usernn&amp;"','"&amp;passw&amp;"')";
  
  rset.Open(sql, con);
  
  con.Close();
  rset.Close();
     }
  </code></pre>