Wrox Programmer Forums
|
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 June 19th, 2006, 12:38 AM
Registered User
 
Join Date: May 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default facing big problem

hi i m facing the error msg
Microsoft VBScript runtime (0x800A000D)
Type mismatch: '[string: "IN54"]'
in the following code.plz help me out.

the code was working fine but since i accept the string txtempid & txtguestid it will error.the error is minor but difficult to locate.



<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Configuration Page</title>
</head>

<body>


<script language=javascript>
    function clickit(c)
    {
        alert(document.frm['chkemp'+c].value);
    }
function SelectAllA()
{
    for(var i=0;i<document.frm.elements.length;i++)
    {
        if(document.frm.elements[i].type == "checkbox")
        {
            document.frm.elements[i].checked = false;
        }
    }
}

function SelectAllB()
{
    for(var i=0;i<document.frm.elements.length;i++)
    {
        if(document.frm.elements[i].type == "checkbox")
        {
            document.frm.elements[i].checked = true;
        }
    }
}
</script><%

' This page will display all the employees under the employee who is configuring the guest
    if Request.ServerVariables("REQUEST_METHOD")="POST" then
        set con=server.createobject("adodb.connection")
        set objrs=server.createobject("adodb.recordset")
        'Dbq=server.mappath("SPG_ProjectDB.mdb")
        con.Open constr

        eid=request.form("hval")
        gid=request.form("gval")
        modif=request.form("cmdmodify")

        ' If opteration was submit then new entries will be made for the guest
        if modif<>"Modify" then
            tarr=split(request.form("chkemp"),",")
            if ubound(tarr) <> 0 then
                for i = 0 to ubound(tarr)
                    con.execute("insert into tb_config values('"&trim(gid)&"','"&trim(tarr(i))&"','guest' )")
                next
            else
                con.execute("insert into tb_config values('"&trim(gid)&"','"&trim(request.form("chkem p"))&"','guest')")
            end if
        else
        ' If operation was modify, then the old configuration will be modified
            con.execute("delete * from tb_config where emp_id='"&gid&"' and type='guest'")
            tarr=split(request.form("chkemp"),",")
            if ubound(tarr) <> 0 then
                for i = 0 to ubound(tarr)
                    con.execute("insert into tb_config values('"&trim(gid)&"','"&trim(tarr(i))&"','guest' )")
                next
            else
                con.execute("insert into tb_config values('"&trim(gid)&"','"&trim(request.form("chkem p"))&"','guest')")
            end if
        end if
        Response.write "<br>"
        Response.write "<br>"

        Response.write ("<b>Your account is configured/modified to view/edit the reports<br> To Go to Admin Area &nbsp;&nbsp;<a href=Admin_index.asp> Click Here </a> or Go to <a href=index.htm> Home</a></b>")
        Response.write "<br>"
        Response.write "<br>"
    else

        set con=server.createobject("adodb.connection")
        set objconfig=server.createobject("adodb.recordset")
        set objemp=server.createobject("adodb.recordset")
        set objemp1=server.createobject("adodb.recordset")
        set objvis=server.createobject("adodb.recordset")
        set objsman=server.createobject("adodb.recordset")
        set objsm=server.createobject("adodb.recordset")


        'Dbq=server.mappath("SPG_ProjectDB.mdb")
        con.Open constr

        dim rs
                max=100
                'Creating an array to hold the recordsets, this array is used as a stack.
                redim rs(max)
                level=-1
                counter=0


        empid = request.querystring("eid")
        guestid = request.querystring("gid")

%>

<form method="POST" action=guestconfig.asp>
    <input type=hidden name=hval value="<%=empid%>">
    <input type=hidden name=gval value="<%=guestid%>">

    <%
         s="select ManagerID from tb_new_employee where EmployeeID='"&empid&"'"
        objsman.open s,con,3,3
        if not objsman.eof then
        'Checking if Employee is not an upper level manager
            if objsman("ManagerID") <> 0 then
                manid=objsman("ManagerID")
                'response.write manid
       'response.end



                    'Get the configuration for the employee
                    s2="select assigned from tb_config where emp_id='"&empid&"'"
                    objconfig.open s2,con,3,3
                    'response.write s2
                    'Get the vis level for the employee
                        s = "select Vis_level from tb_new_employee where EmployeeID='"&empid&"'"
                        objvis.open s,con,3,3
                        thisvl=split(objvis("Vis_level"),"-")
                        if ubound(thisvl) <> 0 then
                            thisvislevel = thisvl(0)
                            thisgroup=thisvl(1)
                        end if

                        str="select EmployeeID,EmployeeName,Vis_level from tb_new_employee order by Vis_level"
                        objemp.open str,con,3,3
                                            'response.write str
                    if objconfig.eof then
                %>
                    <table border="0" width="526" cellspacing="0" cellpadding="0">
                        <tr><td bgcolor="#336699"><p align="center"> </td><td bgcolor="#336699"> </td><td bgcolor="#336699">
                        <b> Configure Your Page</b></td><td bgcolor="#336699"></td><td bgcolor="#336699"></td><td bgcolor="#336699"></td></tr>
                        <tr>
                    <%
                        i=1

                        if not objemp.eof then
                            while not objemp.eof
                                tv=split(objemp("Vis_level"),"-")
                                if ubound(tv) <> 0 then
                                    tempvl=tv(0)
                                    tempgroup=tv(1)
                                    if tempgroup = thisgroup and tempvl*1 >= thisvislevel*1 then
                    %>
                                        <td width="41" height="24"></td><td width="23" height="24">
                                        <input type="checkbox" name="chkemp" value="<%=objemp("EmployeeID")%>" style="font-weight: 700" &<%=objemp("EmployeeID")%>></td>
                                        <td width="440" height="24" <%if objemp("EmployeeID")= empid then %> bgcolor=#EAEAEA<%end if%>><b><%=objemp("EmployeeName")%></b></td>
                <%
                                        'conflag=0
                                        if i mod 2 = 0 then
                                            response.write "</tr><tr>"
                                        end if
                                        i=i+1
                                    end if
                                end if
                                objemp.movenext
                            wend
                        end if
                %>
                    </table>
                    <br> <input type="submit" value="Submit" name="B1">
                <%else%>
                    <table border="0" width="526" cellspacing="0" cellpadding="0">
                        <tr><td bgcolor="#336699"><p align="center"> </td><td bgcolor="#336699"> </td><td bgcolor="#336699">
                        <b> Configure Your Page</b></td><td bgcolor="#336699"></td><td bgcolor="#336699"></td><td bgcolor="#336699"></td></tr>
                        <tr>



                <%
                function getAllChildRecords(empid)

                    level=level+1

                    Set rs(level)= CreateObject("ADODB.Recordset")
                    Set objsnew=server.createobject("adodb.recordset")

                    str="select EmployeeID,EmployeeName,ManagerID,Vis_level from tb_new_employee where ManagerID= '"& empid &"'"

                    rs(level).Open str,con, 3, 3
                    if not rs(level).eof then
                        t=rs(level).fields("EmployeeID")
                    else
                        t=ed
                    end if

                 objsnew.open "select * from tb_new_employee where ManagerID= '"& empid &"'",con,3,3

                if not rs(level).eof then
                    rs(level).movefirst

                    while not rs(level).eof

                        objconfig.movefirst
                        conflag = 0
                        do while not objconfig.eof

                                            if (rs(level).fields("EmployeeID")=objconfig("assigne d")) then
                                                'RESPONSE.WRITE(rs(level).fields("EmployeeID"))&"= "
                                                'RESPONSE.WRITE(objconfig("assigned"))&"<BR>"
                                                conflag=1


                                            end if

                                            objconfig.movenext
                                        loop
                                        'response.write conflag & "<br>"

                %>

                <td width="41" height="24"></td><td width="23" height="24">

                    <input type="checkbox" name="chkemp" value="<%=rs(level).Fields("EmployeeID")%>" style="font-weight: 700" <%if conflag=1 then%>checked<%end if%> <%if rs(level).Fields("EmployeeID")= empid then %> onclick="javascript:clickit('<%=rs(level).Fields(" EmployeeID")%>');" <%end if%> &<%=rs(level).Fields("EmployeeID")%>></td>
                    <td width="308" height="24" <%if rs(level).Fields("EmployeeID")= empid then %> bgcolor=#EAEAEA<%end if%>><b><%=rs(level).Fields("EmployeeName")%></b></td>

                <%
                       if level < max then
                    counter=counter+1
                        if not objsnew.eof then
                            if objsnew("Supervisor")="N" then
                                response.write "</tr><tr>"
                            end if
                        end if

                    getAllChildRecords rs(level).Fields("EmployeeID").Value

                    end if
                       rs(level).MoveNext
                   wend

                end if
        response.write "</tr><tr>"
        'conflag=0

        rs(level).Close
        set rs(level)= nothing
         rowco=0

        level = level - 1

      end function
      getAllChildRecords(empid)
            %>

                <%

                    s1= "select EmployeeID,EmployeeName,ManagerID,Manager,Vis_leve l from tb_new_employee where ManagerID= '"& manid &"'"
                    'response.write "err=" & s1 & "<br>"
                    objsm.open s1,con,3,3
                    'response.write "err1=" & s1 & "<br>"
                    'response.end

                     if not objsm.eof then
                    while not objsm.eof
                        objconfig.movefirst
                        conflag=0

                        do while not objconfig.eof
                                            if objconfig("assigned")= objsm("EmployeeID") then

                                                conflag=1
                                                'response.write conflag & "<br>"
                                                'else
                                                'conflag=0

                                                'response.write conflag & "<br>"

                                            end if
                                            objconfig.movenext
                                        loop

                    %>
                <td width="41" height="24"></td><td width="23" height="24">
                    <%%>
                                        <input type="checkbox" name="chkemp" value="<%=objsm("EmployeeID")%>" style="font-weight: 700" <%if conflag=1 then%>checked<%end if%> <%if objsm("EmployeeID")= empid then %> checked onclick="javascript:clickit('<%=objsm("EmployeeID" )%>');" <%end if%> &<%=objsm("EmployeeID")%>></td>
                                        <td width="308" height="24" <%if objsm("EmployeeID")= empid then %> bgcolor=#EAEAEA<%end if%>><b><%=objsm("EmployeeName")%></b></td>


                <%
                    objsm.movenext
                        wend
                    end if
                    response.write "</tr><tr>"
                    'conflag=0
        %>
                    </table>
                    <br> <input type="submit" value="Modify" name="cmdmodify">
                <%

                end if

            else
                ' If the employee is top manager

                s2="select assigned,type from tb_config where emp_id='"&empid&"'"
                objconfig.open s2,con,3,3
                                    'response.write s2
                thisvislevel = 1


                's2="select EmployeeID,EmployeeName,Vis_level from tb_new_employee where ManagerId = (select EmployeeID from tb_new_employee where ManagerId='0') or ManagerID='0' order by Vis_level"
                s2="select EmployeeID,EmployeeName,Vis_level from tb_new_employee "

                objemp1.open s2,con,3,3
                                    'response.write s2
                if objconfig.eof then

            %>
                    <table border="0" width="526" cellspacing="0" cellpadding="0">
                    <tr><td bgcolor="#336699"><p align="center"> </td><td bgcolor="#336699"> </td><td bgcolor="#336699">
                    <b> Configure Your Page</b></td><td bgcolor="#336699"></td><td bgcolor="#336699"></td><td bgcolor="#336699"></td></tr>
                    <tr>
                <%
                    i=1
                    if not objemp1.eof then
                        while not objemp1.eof
                %>
                                <td width="41" height="24"></td><td width="23" height="24">
                                <input type="checkbox" name="chkemp" value="<%=objemp1("EmployeeID")%>" style="font-weight: 700" &<%=objemp1("EmployeeID")%> ></td>
                                <td width="440" height="24" ><b><%=objemp1("EmployeeName")%></b></td>
            <%
                                conflag=0
                                if i mod 2 = 0 then
                                    response.write "</tr><tr>"
                                end if
                                i=i+1
                                objemp1.movenext
                        wend
                    end if
            %>
                    </table>
                    <br> <input type="submit" value="Submit" name="B1">
            <% else%>
                    <table border="0" width="526" cellspacing="0" cellpadding="0">
                    <tr><td bgcolor="#336699"><p align="center"> </td><td bgcolor="#336699"> </td><td bgcolor="#336699">
                    <b> Configure Your Page</b></td><td bgcolor="#336699"></td><td bgcolor="#336699"></td><td bgcolor="#336699"></td></tr>
                    <tr>
            <%
                    i=1
                    if not objemp1.eof then
                        while not objemp1.eof
                            objconfig.movefirst

                            do while not objconfig.eof

                                if objconfig("assigned")= objemp1("EmployeeID") and objconfig("type")="guest" then
                                    conflag=1
                                end if
                                objconfig.movenext
                            loop
            %>
                            <td width="41" height="24"></td><td width="23" height="24">
                            <input type="checkbox" name="chkemp" value="<%=objemp1("EmployeeID")%>" style="font-weight: 700" <%if conflag=1 then%>checked<%end if%> &<%=objemp1("EmployeeID")%>></td>
                            <td width="440" height="24"><b><%=objemp1("EmployeeName")%></b></td>
                <%
                            if i mod 2 = 0 then
                                response.write "</tr><tr>"
                            end if
                            conflag=0
                            i=i+1
                            objemp1.movenext
                        wend
                    end if
            %>
                    </table>
                    <br> <input type="submit" value="Modify" name="cmdmodify">
                <%end if

            end if
        end if%>
     <input type="reset" value="Reset" name="B2">
</form>
<%end if%>


</body>

</html>


 
Old June 19th, 2006, 01:35 PM
Authorized User
 
Join Date: Jun 2003
Posts: 79
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to erobb Send a message via Yahoo to erobb
Default

>the code was working fine but since i accept the string txtempid & txtguestid it will error.the error is minor but difficult to locate.

Whats in the string?

Earl
www.jhdesigninc.com






Similar Threads
Thread Thread Starter Forum Replies Last Post
i am facing big problem in installation of J2SE Ru david_marsetty Struts 0 July 31st, 2007 01:17 PM
i am facing a problem mkazim85 SQL Language 2 April 20th, 2007 07:28 AM
Facing problem with commandtimeout altaf SQL Server ASP 0 June 27th, 2003 08:33 AM
Facing problem with commandtimeout altaf Classic ASP Databases 0 June 27th, 2003 08:27 AM
Facing problem with commandtimeout altaf SQL Server 2000 0 June 27th, 2003 08:25 AM





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