Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old March 3rd, 2005, 03:02 AM
Registered User
Join Date: Feb 2005
Location: Pune, Maharastra, India.
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to nlpatel78
Default Type mismatch: 'htmlEncode'

I got following error

Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch: 'htmlEncode'
/etravel1.0/ERParameters.asp, line 162

Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322)

i have given code below.
can someone help me resolving this issue URGENTLY.

<%@ Language=VBScript %>
<%option explicit
Response.Buffer =true
Const AccountNo_Width = 15%>
function GetValue_Sys(aKey,aVar)
    if instr("DESC1,DESC2",aVar)>0 then GetValue_Sys=""
    For iCounter = 1 to uBound(arrParameters)
        if arrParameters(iCounter,1)=aKey then
            select case aVar
                case "DESC1" : GetValue_Sys=arrParameters(iCounter,2)
                case "DESC2" : GetValue_Sys=arrParameters(iCounter,3)
                case "DESC3" : GetValue_Sys=arrParameters(iCounter,4)
                case "VALUE1" : GetValue_Sys=arrParameters(iCounter,5)
                case "VALUE2" : GetValue_Sys=arrParameters(iCounter,6)
                case "VALUE3" : GetValue_Sys=arrParameters(iCounter,7)
            end select
            exit for
        end if
end function
Sub Save_SystemParameters()
Dim ConnObj, iPos
    Set ConnObj = Server.CreateObject("ADODB.Connection")
    ConnObj.Open Session("ConnString")

        iPos = 0
        for i=1 to 50
            iPos=i : if len(iPos)=1 then iPos = "0" & iPos
            if trim(Request.Form("ExpAccountNo"&i)) <> "" and trim(Request.Form("ExpAccountHead"&i)) <> "" then
                Call UpdateSetup(ConnObj,"ERSEC_"&iPos, Request.Form("ExpAccountHead"&i), Request.Form("ExpAccountNo"&i),"",BookBy(Request.F orm("ExpBookByEmployee"&i)),BookBy(Request.Form("E xpCostcentre"&i)),0)
            end if
    Set ConnObj = Nothing
    session("mMsg")="System Parameters are updated successfully"
    Response.Redirect "screen.asp"
End Sub
function BookBy(mCheckbox)
    if mCheckbox <> "" then
    end if
end function
function UpdateSetup(ConnObj,aKey,aDesc1,aDesc2,aDesc3,aVal ue1,aValue2,aValue3)

dim sqlstr, rstSetup
    set rstSetup=server.CreateObject("ADODB.Recordset")
    sqlstr="select * from setup where KEY= '" & aKey & "'"
    rstSetup.Open SqlStr,ConnObj, adOpenDynamic,adLockOptimistic, adcmdtext
    if rstSetup.eof then
    end if
    if Trim(aValue1)<> "" then
    end if
    if Trim(aValue2)<> "" then
    end if
    if Trim(aValue3)<> "" then
    end if
    set rstSetup = nothing

end function
Dim arrParameters(),SqlStr,iCounter,rstSetup
Dim i,j,RPTCurr1,SubmitFlag,VoucherRemarks1_TR,Voucher Remarks2_TR,VoucherRemarks3_TR,VoucherRemarks1_ER, VoucherRemarks2_ER,VoucherRemarks3_ER
Dim KeyPressCode
Dim ConnObj,OtherDetail_Desc

if session("LoggedOut") then Response.Redirect "message.asp"

SubmitFlag = Request.Form("txtSubmitFlag")
Set ConnObj = Server.CreateObject("ADODB.Connection")
ConnObj.Open Session("connString")

If SubmitFlag="True" then
End If

Set rstSetup=server.CreateObject("ADODB.Recordset")
Sqlstr="Select * from setup"
rstSetup.CursorLocation = aduseclient
rstSetup.Open SqlStr,ConnObj,adOpenDynamic,adLockOptimistic
if rstSetup.RecordCount > 0 then
    redim arrParameters(rstSetup.RecordCount,7)
    redim arrParameters(1,7)
end if
Do while not rstSetup.eof
    iCounter = iCounter + 1

set rstSetup = Nothing
KeyPressCode = "LANGUAGE='javascript' onfocus='select()' onKeyPress='keyhandler()'"
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<link href="Eilisys.css" rel="STYLESHEET" type="text/css">
<link href="Menu/coolmenu.css" rel="STYLESHEET" type="text/css">
<script type="text/javascript" src="Menu/coolmenupro.js"></script>

<FORM Name="thisForm" Id="thisForm" Method="Post" action="ERParameters.asp" >
<table BORDER="0" CELLSPACING="0" CELLPADDING="0" rightmargin="0" CLASS="full">
    <tr><td colspan="2" valign="middle" height="5px"></td></tr>
    <tr height="30px">
        <td valign="top" align="center" width="98%">
            <table BORDER="0" CELLSPACING="0" CELLPADDING="0" width="100%">
                    <td width="85%" class="SelectedMenu">&nbsp;&nbsp;<img src="images/ImgMenu/inbox.gif" border="0">&nbsp;&nbsp;Expense Report Parameters</td>
                    <td width="15%"><a href="screen.asp"><img src="Images/reset.gif" border="0" Style="Cursor:Hand"></a>Exit</td>
                <tr><td colspan="2"><BR></td></tr>
        <td align="center">
            <table border=0 width=65% class="stdTableBorder" cellspacing=0 cellpadding=1 valign=top align=center>
                <TR bgcolor="#6186B3" height="22px">
                    <TD nowrap width="30%" class="InnerHeader">Account Head</TD>
                    <TD nowrap width="20%" class="InnerHeader">Account No</TD>
                    <TD nowrap width="25%" class="InnerHeader">Book by Employee</TD>
                    <TD nowrap width="25%" class="InnerHeader">Book by Cost Centre<Input type="HIDDEN" Name="txtSubmitFlag" Id="txtSubmitFlag" Value="">
                <%for i=1 to 50
                    j = right("0" & i,2) %>
                    <TD nowrap><INPUT type="text" class="inputalignleft" id="ExpAccountHead<%=i%>" name="ExpAccountHead<%=i%>" size=30 maxlength=20 value="<%=Server.htmlEncode(GetValue_Sys("ERSEC_"& J,"DESC1"))%>" <%=KeyPressCode%>></TD>
                    <TD nowrap><INPUT type="text" class="inputalignleft" id="ExpAccountNo<%=i%>" name="ExpAccountNo<%=i%>" size=10 maxlength=10 value="<%=GetValue_Sys("ERSEC_"&J,"DESC2") %>" <%=KeyPressCode%>></TD>
                    <TD nowrap align=center>
                        <INPUT type="checkbox" id="ExpBookByEmployee<%=i%>" name="ExpBookByEmployee<%=i%>" <%=KeyPressCode%> <%if 1 = GetValue_Sys("ERSEC_"&J,"VALUE1") then Response.Write "Checked"%> ></TD>
                    <TD nowrap align=center><INPUT type="checkbox" id="ExpCostcentre<%=i%>" name="ExpCostcentre<%=i%>" <%=KeyPressCode%> <%if 1= GetValue_Sys("ERSEC_"&J,"VALUE2") then Response.Write "Checked"%> ></TD>
        <td align="center">
                    <TD align=center>
                        <input type="Button" name="BtnSubmit" Id="BtnSubmit" Class="stdButton" Title="Click To Update System Parameters" value="Save Parameters" onClick="BtnSubmit_Onclick();">
Set ConnObj = Nothing
<script language="javascript">
    function BtnSubmit_Onclick()
        document.thisForm.txtSubmitFlag.value = "True"
    function ProcessKeyDown()
        if (window.event.keycode = 13)
            window.event.keycode = 9;
// if (document.layers) document.captureEvents(Event.KEYPRESS); // needed if you wish to cancel the key
    document.onkeydown = keyhandler;
// document.myForm.myField.onkeypress = keyhandler;

    function keyhandler(e)
    var key;
    var keychar;
    var reg;

    if (window.event)
        if (window.event.keyCode == 13)
            // for IE, e.keyCode or window.event.keyCode can be used
            key = window.event.keyCode;
    else if(e.which == 13)
        // netscape
    else {
        // no event, so pass through
        return true;
    keychar = String.fromCharCode(key);
    reg = /\d/;
    return !reg.test(keychar);


Old March 3rd, 2005, 06:39 AM
Friend of Wrox
Join Date: Jul 2003
Location: , , United Kingdom.
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post

Hi Neel,

This error normally gets thrown when the variant you pass to Server.HTMLEncode is null.

Your arrParameters array is probably storing a null value from the recordset.



Similar Threads
Thread Thread Starter Forum Replies Last Post
type mismatch peonysmiles ASP.NET 1.0 and 1.1 Basics 0 August 26th, 2008 08:38 AM
type mismatch frresh Pro Visual Basic 2005 1 April 11th, 2006 08:35 AM
Type Mismatch ozPATT VB How-To 1 September 18th, 2005 01:00 PM
Type mismatch sporkman43 Classic ASP Basics 4 August 14th, 2003 03:27 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.