I am trying to write to database based on the id. I am having trouble specifying the id number with an input box. If I set the number in the code it works fine, but I'm getting an error when I try grabbing the id from input.
My HTML has an input field with id='idnumber'
var path= "C:\\Users\\joshr\\fullpathtomyfile\\filename.accdb";
var idnumber = document.getElementById('idnumber').value;
var cn = new ActiveXObject("ADODB.Connection");
var rs = new ActiveXObject("ADODB.Recordset");
var strConn = "Provider=microsoft.ace.oledb.12.0;Data Source=" + path;
cn.Open(strConn);
rs.Open("SELECT MAX(Resolved) FROM reporting", cn);
rs.MoveFirst;
var maxID = rs.Fields.Item(0);
maxID = maxID + 1;
rs.Close();
var sql = "UPDATE reporting SET Resolved='YES' WHERE ID='+idnumber+'";
I have also have tried:
var sql = "UPDATE reporting SET Resolved='YES' WHERE ID='idnumber'";
var sql = "UPDATE reporting SET Resolved='YES' WHERE ID=idnumber";
This one works but i need the number to be user input.
var sql = "UPDATE reporting SET Resolved='YES' WHERE ID=3";
rs.Open(sql, cn);
cn.Close();
I also tried
var sql = "UPDATE reporting SET Resolved='YES' WHERE . ((reporting.ID)='"+idnumber+"')";
The result of this is "Data type mismatch in criteria expression."
EDIT: I still need help with this