×

Discussion Board

Results 1 to 2 of 2

Thread: wml and asp

  1. #1
    Registered User
    Join Date
    Jan 2004
    Posts
    8

    wml and asp

    Hi

    i insert an asp code in my wml page when i execute it i had this message http error 500 internal sever error
    I have a difficulties to specifies the error with a like message.

    there is my code .Database is implemented in sqlserver.

    <%Response.ContentType="text/vnd.wap.wml"%>
    <?xml version="1.0"?>
    <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">

    <!-- created by EasyPad WAPtor (http://www.waptop.net/) -->
    <wml>
    <card id="connection" title="Connection">
    <p>
    <%
    dim dbConn,sql,c
    Set dbConn = Server.CreateObject("ADODB.Connection")
    dbConn.open("dsn=base")
    sql="select code from tablval where code='"&Request.Form("code")&"'"
    set c=dbConn.Execute(sql)
    if c.EOF then
    Response.Write"Login invalid"
    else
    <%URL="page.wml"%>
    <%Response.Redirect"URL"%>
    end if
    c.Close
    dbConn.close
    set c=Nothing
    set dbConn=Nothing
    %>
    </p>
    </card>
    </wml>


    Thank for help

  2. #2
    Registered User
    Join Date
    Jan 2004
    Posts
    3
    Try using this.....

    <%@ Language=VBScript %>
    <!-- #INCLUDE FILE="inc/xmlutil.asp" -->

    <% Function GetRecordset()
    Dim cnn

    Set cnn = CreateObject("ADODB.Connection")
    cnn.Open "Provider=SQLOLEDB.1;Initial Catalog=PUBS;Data Source=ServerData", "Server", "password"
    Set GetRecordset = cnn.Execute("select * from authors")
    End Function %>

    <html>
    <head>
    <title>Straight XML Approach</title>
    <link rel="stylesheet" type="text/css" href="default.css">
    </head>
    <body>
    <h1>Default IE5 View</h1>
    <% = TransformXML( RecordsetToXMLDoc(GetRecordset(), "author"), "xsl/defaultss.xsl" ) %>
    </body>
    </html>



    Include file is as ........


    <%
    function AddXMLNode( DOMXML, Parent, Name, Value )
    Set AddXMLNode = AddXMLNodeEx( DOMXML, Parent, Name, Value, "" )
    End Function

    function AddXMLNodeEx( DOMXML, Parent, Name, Value, Namespace )
    dim objNode
    set objNode = DOMXML.createNode( 1, LCase(Name), Namespace)
    if Len(Value) <> 0 then
    objNode.text = Trim(Value)
    end if
    Parent.appendChild objNode
    set AddXMLNodeEx = objNode
    End Function

    function transformXML( XML, XSL )
    Dim objXML
    Dim objXSL

    Set objXML = getXMLDoc(XML)
    Set objXSL = getXMLDoc(XSL)
    If objXML.parseError <> 0 Then Response.Write reportParseError(objXML.parseError)
    If objXSL.parseError <> 0 Then Response.Write reportParseError(objXSL.parseError)

    transformXML = objXML.transformNode(objXSL)
    End Function

    Function getXMLDoc( XML )
    Dim objXML
    If IsObject(XML) Then
    set objXML = XML
    Else
    Set objXML = Server.CreateObject("Microsoft.XMLDOM")

    If InStr(XML,"<") > 0 Then
    'This is a string because < is not valid in a filename
    objXML.LoadXML XML
    Else
    objXML.load(Server.MapPath(XML))
    End If
    End If

    Set getXMLDoc = objXML
    End Function

    Function RecordsetToXMLDoc( rs, NodeName )
    Dim objNodeCol, objNode, objXML, x
    set objXML = Server.CreateObject("Microsoft.XMLDOM")
    Set objNodeCol = AddXMLNode( objXML, objXML, NodeName & "s", "" )
    while rs.EOF = False
    Set objNode = AddXMLNode( objXML, objNodeCol, NodeName, "" )
    for each x in rs.fields
    AddXMLNode objXML, objNode, x.Name, Trim(x.Value)
    Next
    rs.MoveNext
    wend
    Set RecordsetToXMLDoc = objXML
    End Function

    %>


    <script language=javascript runat=server>
    // Parse error formatting function
    function reportParseError(error)
    {
    var s = "";
    for (var i=1; i<error.linepos; i++) {
    s += " ";
    }
    r = "<font face=Verdana size=2><font size=4>XML Error loading '" +
    error.url + "'</font>" +
    "<P><B>" + error.reason +
    "</B></P></font>";
    if (error.line > 0)
    r += "<font size=3><XMP>" +
    "at line " + error.line + ", character " + error.linepos +
    "\n" + error.srcText +
    "\n" + s + "^" +
    "</XMP></font>";
    return r;
    }

    // Runtime error formatting function
    function reportRuntimeError(exception)
    {
    return "<font face=Verdana size=2><font size=4>XSL Runtime Error</font>" +
    "<P><B>" + exception.description + "</B></P></font>";
    }
    </script>

Posting Permissions

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