This ASP code (below) is used by my Flash file to connect to an Access database specified in the Flash file with a query the Flash file sends to this ASP script which then runs the query on the Access database and returns the result as XML to my Flash file.
Unfortunately, the results it returns interprets the HTML code in the result as text not as HTML tags. From what I have read, ASP often converts these HTML tags in the results.
E.g. <font size="1">Test
</font&
gt; instead of <font size="1">Test</font>
Does anyone know how to modify this ASP to fix this problem?
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%
'.........................
..........
..........
..........
..........
..........
..........
...
dim objErr
dim conMode
dim lcktype
set objErr=Server.GetLastError
()
'.........................
..........
..........
..........
..........
..........
..........
...
'Set the mail privilege here and optionally disable the SQL query function as well.......
Dim sendmail, runSQL
sendmail = true
runSQL = true
'.........................
..........
..........
..........
..........
..........
..........
...
Response.Write ("<?xml version=""1.0"" encoding=""utf-8""?> <flashsql>")
If Request.QueryString("typ")
="mail" and sendMail=true Then
If Request.Form("to") <> "" Then
Set flashMail=CreateObject("CD
O.Message"
)
flashMail.Subject=Request.
Form("subj
")
flashMail.From=Request.For
m("from")
flashMail.To=Request.Form(
"to")
flashMail.HTMLbody=Request
.Form("msg
")
flashMail.send()
set flashMail = nothing
end if
Else
Dim Value_sql, F_host, F_uid, F_pword, F_dat, F_sql, F_db
Dim recordSets
Dim objConn
'.........................
..........
..........
..........
..........
..........
.........
F_host = Request.Form("host")
F_dat = Request.Form("dat")
F_sql = Request.Form("sql_")
F_pword = Request.Form("pword")
F_uid = Request.Form("uname")
F_db = Request.Form("db")
'.........................
..........
..........
..........
..........
..........
.........
Set objConn=Server.CreateObjec
t("ADODB.C
onnection"
)
objConn.Mode = 3
If F_db = "MS Access" Then
objConn.Open "Provider=Microsoft.Jet.OL
EDB.4.0;Da
ta Source=" & Server.MapPath(F_dat) & "; User ID=" & F_uid & "; Password=" & F_pword
elseif F_db = "ODBC" Then
objConn.Open "DRIVER={MySQL ODBC 3.51 Driver}; SERVER=localhost; DATABASE=" & F_dat & "; UID=" & F_uid & ";PASSWORD=" & F_pword & "; OPTION=3"
elseif F_db = "MSSQL" Then
objConn.Open "Provider=SQLOLEDB; Data Source=" & F_host & "; Initial Catalog=" & F_dat & "; User ID=" & F_uid & "; Password=" & F_pword
else
objConn.Open "Driver={SQL Server}; Server=" & F_host & "; Database=" & F_dat & "; Uid=" & F_uid & "; Pwd=" & F_pword
end if
'.........................
..........
..........
..........
..........
..........
..........
Set recordSets = Server.CreateObject("ADODB
.Recordset
")
recordSets.LockType = 3
on error resume next
Set recordSets = objConn.Execute(F_sql)
if err<>0 then
Response.Write ("<database_connection>0</
database_c
onnection>
")
Response.Write ("<database_connection>Err
or Description:" & err.Description & ", Source:" & err.Source & ", Error Number:" & err & "</database_connection>")
Response.Write ("<database_selection>0</d
atabase_se
lection>")
Response.Write ("<database_selection>Erro
r Description:" & err.Description & ", Source:" & err.Source & ", Error Number:" & err & "</database_selection>")
Response.Write ("<sql>0</sql>")
else
Response.Write (" <database_connection>1</da
tabase_con
nection>")
Response.Write (" <database_selection>1</dat
abase_sele
ction>")
Response.Write (" <sql>1</sql>")
Response.Write (" <results>")
if instr(1, F_sql, "SELECT", 1) or instr(1, F_sql, "select", 1) Then 'Output the selected results...
do until recordSets.EOF
Response.Write "<record>"
for each x in recordSets.Fields
Response.Write("<" & x.name & "><![CDATA[")
Response.Write(x.value)
Response.Write("]]></" & x.name & ">")
next
Response.Write("</record>"
)
recordSets.MoveNext
loop
else
Response.Write ("<status executed=""true"" />")
end if
Response.Write ("</results>")
end if
set recordSets = nothing
set objConn = nothing
End if
'-------------------------
----------
----------
----------
----------
----------
----------
-------
Response.Write("</flashsql
>")
%>
Start Free Trial