theniteowl
Programmer
Hi All,
I am using GetString to pull records from a table and dump them into a Javascript array.
Existing text data in one of the table fields has single quotes which is causing my Javascript to bomb when initializing the array.
How can I handle the single quotes and still use GetString without modifying the data to remove single quotes?
Here is my code.
At my age I still learn something new every day, but I forget two others.
I am using GetString to pull records from a table and dump them into a Javascript array.
Existing text data in one of the table fields has single quotes which is causing my Javascript to bomb when initializing the array.
How can I handle the single quotes and still use GetString without modifying the data to remove single quotes?
Here is my code.
Code:
SQLC = "SELECT * FROM Service_RequestType WHERE dep_id='" & CampusID & "' ORDER BY request_desc"
set rsl=mCN.execute(SQLC)
If rsl.EOF AND rsl.BOF Then
'No record exists so set default value for array
outstr = ""
Else
rsstring = rsl.GetString(,,"','","','","")
outstr = "'" & Left(rsstring,len(rsstring)-2)
End If
Response.Write "<SCR" & "IPT TYPE=""text/JavaScript"">" & vbCrlf
Response.Write "var arrDesc = new Array(" & outstr & ");" & vbCrLf
Response.Write "</SCR" & "IPT>" & vbCrlf
rsl.Close
Set rsl = Nothing
At my age I still learn something new every day, but I forget two others.