leearach2004
Technical User
Hi there i have set of javascript funtions that call information from a database
I am using a where clause in my sql statment
this works fine when checking a field in the database that is a number but if i want to check a field in the database that is a text field it doesnt wotk
here is the funtion
function get_fyp() {
var data = new Array()
//select record number
id = "1";
//select record from database
var rs = new ActiveXObject("ADODB.Recordset")
rs.open("SELECT * FROM fyptext WHERE ID = " + id, conn, adOpenDynamic, adLockOptimistic)
rs2arr(rs, data)
rs.close()
// Read the resulting transaction state into the form
document.getElementById("fyp_subject").value = data["subject"]
document.getElementById("fyp_description").value = data["description"]
}
this all works fine as it is but if i want to change the variable id to somthing like
id="IT DEP";
assuming that the id field in the database is now set to text and contains the word IT DEP it doesnt work the error say no value given for one or more required paramiters
I dont understand why as all i am doing is using the WHERE statment with text insted of a number
anyone have any ideas id be most greatful
lee
I am using a where clause in my sql statment
this works fine when checking a field in the database that is a number but if i want to check a field in the database that is a text field it doesnt wotk
here is the funtion
function get_fyp() {
var data = new Array()
//select record number
id = "1";
//select record from database
var rs = new ActiveXObject("ADODB.Recordset")
rs.open("SELECT * FROM fyptext WHERE ID = " + id, conn, adOpenDynamic, adLockOptimistic)
rs2arr(rs, data)
rs.close()
// Read the resulting transaction state into the form
document.getElementById("fyp_subject").value = data["subject"]
document.getElementById("fyp_description").value = data["description"]
}
this all works fine as it is but if i want to change the variable id to somthing like
id="IT DEP";
assuming that the id field in the database is now set to text and contains the word IT DEP it doesnt work the error say no value given for one or more required paramiters
I dont understand why as all i am doing is using the WHERE statment with text insted of a number
anyone have any ideas id be most greatful
lee