MsgBox Error in ASP

Discussion in 'C#' started by maxwellpwr, Apr 7, 2009.

  1. #1
    Out of necessity, I had to start modifying an asp page which is where I'm running into difficulty. (My previous experience is with php and javascript which I'm very comfortable with.)


    I keep getting the following error:
    Microsoft VBScript runtime error '800a000d'
    Type mismatch: 'Check_Errors' ​

    It seems to be due to the MsgBox. If I comment out the MsgBox line, it runs fine. I want to be able to have the message box though. Could you let me know what's wrong with it?



    
    <%
    if Session("Verified") <> "Y" then
    	Response.Redirect "login.asp"
    end if
    %>
    <script language="vbscript">
    <!--
    Sub Check_Errors()
    Dim rstHEX_Error
    Dim DataConn
    Dim sqlSelect
    Dim sSCACCode
    Dim sResult
    
    Set DataConn = Server.CreateObject("ADODB.Connection")
    DataConn.Open(Session("ConString"))
    'sSCACCode = rstHEX_Login("UserSCAC")
    sSCACCode = "ZXCV"
    sqlSelect = "SELECT * FROM HEX_Error WHERE SCAC = '" & sSCACCode & "' AND ErrorAckd = 'N'"
    set rstHEX_Error = DataConn.Execute(sqlSelect)
    If NOT rstHEX_Error.eof Then
    	Response.Write "Errors Found"
    	'Response.End
    	'sResult = msgbox ("214 were in error please visit the 824 Error screen to acknowledge\view the errors",vbExclamation, "Confirm")
    End If
    
    End Sub
    
    
    -->
    </script>
    
    
    <HTML>
    <title>Main Menu</title>
    <BODY>
    <% Call Check_Errors()%>
    
    <P><A href="214Add.asp"><FONT face=sans-serif>View 214 Transactions </FONT>  </A><FONT face=sans-serif> </FONT> </P>
    <P><A href="214Add.asp"><FONT face=sans-serif>Add 214 Transactions </FONT>   </A></P>
    <P><A href="logout.asp"><FONT face=sans-serif>Log Out</FONT>    </A></P>
    
    </BODY></HTML>
    Code (markup):
     
    maxwellpwr, Apr 7, 2009 IP
  2. emlak

    emlak Peon

    Messages:
    50
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    msgbox not supported asp
    I do not understand what you are trying to do.
    if do you want to use msgbox use javascript alert('<%=xx%>') function.
    sub procedures must be used with <% sub .....%> in asp
     
    emlak, Apr 8, 2009 IP
  3. maxwellpwr

    maxwellpwr Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks, that does help get me going in the right direction again. +1 on your rep
     
    maxwellpwr, Apr 8, 2009 IP
  4. pharmacy

    pharmacy Peon

    Messages:
    51
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    you can use the message box function but you can you this function created and used by me
    'message box
    function msg_box(s_message)
    Response.Write "<script language=javascript>"
    Response.Write "alert(""" & s_message & """);"
    Response.Write "</script>"
    end function

    Remember to add response.end at the end

    Ranjan
     
    pharmacy, Apr 11, 2009 IP
  5. camjohnson95

    camjohnson95 Active Member

    Messages:
    737
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #5
    won't all the code within <script language="vbscript> execute client-side?
     
    camjohnson95, Apr 13, 2009 IP
  6. dwirch

    dwirch Well-Known Member

    Messages:
    239
    Likes Received:
    12
    Best Answers:
    1
    Trophy Points:
    135
    #6
    ASP pages all execute serverside, IIRC. The code the OP pasted is meant for use on a local machine, ie, vbscript run directly on a Windows box. The ASP processor of IIS doesn't have support for the msgbox function.

    Pharmacy's Javascript solution should do the trick, though.
     
    dwirch, Apr 22, 2009 IP