简体   繁体   中英

Javascript retrive values from MS Access based on textbox value

I probably have a simple issue which I cannot figure.

I have a textbox ID "date_added" and have written a JavaScript sql statement to retrieve values based on this textbox value to make it dynamic.

var dateadded = document.form_name.date_added.value;
var currentuser = "SELECT * FROM productivity WHERE date_added='dateadded';";

If i replace 'dateadded' with an exact date (eg 7-May-2014) I am able to retrieve results. seems like i have my syntax incorrect.

kindly help. thanks!

Here is the correct method to pass date from variable dateadded

var currentuser = "SELECT * FROM productivity WHERE date_added='"+dateadded+"';";

you are passing dateadded as a text and not as a variable holding date value

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM