Advertisement

07.14.2008 at 07:39PM PDT, ID: 23564874
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.8

ASP querying Access database displays HTML tags as text

Asked by littlemutts in Active Server Pages (ASP), Extensible Markup Language (XML), SQL Query Syntax

Tags:

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.     &lt;font size=&quot;1&quot;&gt;Test&lt;/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("CDO.Message")
            flashMail.Subject=Request.Form("subj")
            flashMail.From=Request.Form("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.CreateObject("ADODB.Connection")
            objConn.Mode = 3
            If F_db = "MS Access" Then
                  objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data 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_connection>")
                  Response.Write ("<database_connection>Error Description:" & err.Description & ", Source:" & err.Source & ", Error Number:" & err & "</database_connection>")
                  Response.Write ("<database_selection>0</database_selection>")
                  Response.Write ("<database_selection>Error Description:" & err.Description & ", Source:" & err.Source & ", Error Number:" & err & "</database_selection>")
                  Response.Write ("<sql>0</sql>")            
            else
                  Response.Write (" <database_connection>1</database_connection>")
                  Response.Write (" <database_selection>1</database_selection>")
                  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
[+][-]07.14.2008 at 10:49PM PDT, ID: 22004392

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Active Server Pages (ASP), Extensible Markup Language (XML), SQL Query Syntax
Tags: ASP
Sign Up Now!
Solution Provided By: _Stilgar_
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628