Professional Web Applications Themes

ASP error - HTMLEncode - ASP Database

Hey guys I had an error that I managed to sort out the other day. Even though it was an error on my part, thanx to those who gave me suggestions. However, now I have a new prob. I'm trying to access fields in an ADO recordset on Win 2000 Professional and IIS 5.0. I've managed to debug a few errors in the code myself but I can't get past this one. The error message on IE is: Page cannot be displayed Error Type: Microsoft VBScript runtime (0x800A000D) Type mismatch: 'HTMLEncode' /PatentsDB/patentstable.asp, line 43 The code I'm running is: Open ...

  1. #1

    Default ASP error - HTMLEncode

    Hey guys

    I had an error that I managed to sort out the other day.
    Even though it was an error on my part, thanx to those who
    gave me suggestions. However, now I have a new prob.

    I'm trying to access fields in an ADO recordset on Win
    2000 Professional and IIS 5.0. I've managed to debug a few
    errors in the code myself but I can't get past this one.
    The error message on IE is:

    Page cannot be displayed

    Error Type:
    Microsoft VBScript runtime (0x800A000D)
    Type mismatch: 'HTMLEncode'
    /PatentsDB/patentstable.asp, line 43

    The code I'm running is:

    Open the connection and recordset:
    <%
    Set cnn1 = Server.CreateObject("ADODB.Connection")
    openStr = "driver={Microsoft Access Driver
    (*.mdb)};DBQ=c:\inetpub\wwwroot\PatentsDB\PatentsD B.mdb"
    cnn1.Open openStr,"",""

    sql = "SELECT * FROM [tbdPatents];"
    Set rsPnts = Server.CreateObject("ADODB.Recordset")
    rsPnts.Open sql, cnn1
    %>

    I loop via:
    Do While Not rsPnts.EOF

    and create table cells via:
    <tr valign="TOP">
    <td><%=Server.HTMLEncode(rsPnts.Fields
    ("txtPatentID").Value)%></td>
    <td><%=Server.HTMLEncode(rsPnts.Fields
    ("txtGenericName").Value)%></td>
    <td><%=Server.HTMLEncode(rsPnts.Fields
    ("txtBrandName").Value)%></td>
    <td><%=Server.HTMLEncode(rsPnts.Fields
    ("txtManufacturer").Value)%></td>

    This is where the error occurs. Why am I getting a type
    mismatch?

    Any suggestions?

    Thanx
    A-Face


    A-Face Guest

  2. #2

    Default Re: ASP error - HTMLEncode

    "A-Face" <microsoft.com> wrote in message
    news:3eac01c4ac6a$deb65a60$gbl... 

    Why are you using "Server.HTMLEncode()"?

    Have you tried your code without it?


    McKirahan Guest

  3. #3

    Default Re: ASP error - HTMLEncode

    Such a simple solution, thanx. It's now working.

    However, I do have another query. When opening the
    connection, I'm met with an error if I add cursor, lock or
    command types. If I take them out it works.

    The connection is the same as in my previous post except
    for the 7th line:
    rsPnts.Open sql, cnn1, adOpenForwardOnly, adLockReadOnly,
    adCmdText

    The error I get is:

    Error Type:
    ADODB.Recordset (0x800A0BB9)
    Arguments are of the wrong type, are out of acceptable
    range, or are in conflict with one another.
    /PatentsDB/patentstable.asp, line 13

    Any suggestions?

    Thanx
    A-Face

     
    message [/ref]
    who [/ref]
    few 
    >
    >Why are you using "Server.HTMLEncode()"?
    >
    >Have you tried your code without it?
    >
    >
    >.
    >[/ref]
    A-Face Guest

  4. #4

    Default Re: ASP error - HTMLEncode

    "A-Face" <microsoft.com> wrote in message
    news:173001c4ac6d$026b3690$gbl... 

    If it works without a cursor why would you want to use one?

    Is your ASP page and database in the same folder; i.e. "PatentsDB"?
    Is "PatentsDB" a subfolder under the ASP page's folder?
    I'll presume the latter and use Server.MapPath() below.
    This variation also uses a different DSN-less connection string.

    <%
    Option Explicit

    'Const cDSN = "driver={Microsoft Access Driver(*.mdb)};DBQ="
    Const cDSN = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
    Const cMDB = "PatentsDB\PatentsDB.mdb"

    Dim objADO
    objADO = Server.CreateObject("ADODB.Connection")
    objADO.Open cDSN & ServerMapPath(cMDB)
    Dim strSQL
    strSQL = "SELECT * FROM [tbdPatents]"
    Set objRST = Server.CreateObject("ADODB.Recordset")
    objRST.Open strSQL, objADO

    Do While Not objRST.EOF
    %>
    <tr valign='top'>
    <td><%=objRST("txtPatentID")%></td>
    <td><%=objRST("txtGenericName")%></td>
    <td><%=objRST("txtBrandName")%></td>
    <td><%=objRST("txtManufacturer")%></td>
    </tr>
    <%
    objRST.MoveNext
    Loop
    Set objRST = Nothing
    Set objADO = Nothing
    %>


    McKirahan Guest

Similar Threads

  1. How to decode strings encoded with HTMLEncode
    By Rob Roberts in forum ASP Components
    Replies: 1
    Last Post: June 1st, 07:31 PM
  2. Replies: 0
    Last Post: March 29th, 09:49 PM
  3. Replies: 1
    Last Post: August 7th, 07:13 PM
  4. DataGrid and Htmlencode
    By Michal Raatz in forum ASP.NET General
    Replies: 0
    Last Post: July 29th, 07:21 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139