Code Examples
  Home arrow Code Examples arrow Implementing ASP into WML code using dynam...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
CODE EXAMPLES

Implementing ASP into WML code using dynamic data from MSAccess.
By: aspfree
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 21
    2000-07-28

    Table of Contents:

    Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Create dynamic WAP pages with WML and ASP - By Michael Wright

    In my last set of articles I told you how to getstarted with WML and gave a brief explanation of how ASP can beimplemented into WML code. Please read these articles before this oneby going to http://www.aspfree.com/authors/michaelw/wap/default.asp.This article will give examples of implementing ASP into WML code andshow you how to make your WAP site change as your normal website doesevery time you update your MS Access databases.

    So, you have created your WAP site and have started updating itevery time you update your regular website but it’s just taking so longto do. One of the easiest ways to update a website is to make itdynamic so that when you update one element of the site another thingchanges in conjunction with it. For example, if you were to create anews section within your website you could have a start page displayingthe headlines, which if the user clicked a headline another page woulddisplay the whole article. All the data would be grabbed from adatabase with simple fields like ID, Date, Headline and Article.

    Now, if you can create a HTML/ASP version ofthe above then it’s relatively simple to create a WML/ASP version. Ifyou do not know how to create a HTML/ASP version of the above then youshould learn that first by going to http://www.aspfree.com/demos.asp and check out the ASP-DATABASE section. To view a live version of a news section please go to http://www.vetsonline.com/html/news.htm.

    Below is an example of how to create the WML/ASP version (you shouldchange all the words in the ASP code in Red where appropriate):

    <% Response.ContentType = "text/vnd.wap.wml" %><?xml version="1.0" encoding="iso-8859-1"?>

    <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">

    <wml>

    <!-- THIS IS THE MAIN CARD OF THE DECK -->

    <card id="MainCard">

    <p align="left"><small><b>NEWS STARTPAGE WAP EXAMPLE </b></small></p>

    <%

    strconn = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("LOCATION OF DATABASE")

    set conn = server.createobject("adodb.connection")

    conn.open strconn

    set rs = server.createobject("adodb.recordset")

    QueryDate = "July 2000" 'enter this months date or for daily news, todays date e.g. Date()

    Query = "Select * from DATABASE TABLE Where FIELD NAME LIKE '%" &QueryDate &"%' ORDER BY id"

    rs.open Query, conn

    if not rs.eof Then

    rs.movefirst

    Do While NOt Rs.EOF

    id = rs("id") 'read each id as it displays the headlines

    %>

    <p align="left"><small><anchor><%=rs("Headline")%><go href="ASP PAGE TO VIEW ARTICLE.asp?id=<%=id%>"/></anchor></small></p>

    <%

    rs.movenext

    Loop

    else

    response.write("<p align='left'><small>There are no news articles this month as yet.</small></p>")

    End if

    ' close everything

    rs.close

    Set conv = nothing

    set rs= nothing

    set conn = nothing

    %>

    <p align="left"><small><a href="PREVIOUS PAGE ">Back</a></small></p>

    </card>

    </wml>

     

    You must now create the WML/ASP page to display the actual articleswhere you are linking the Headlines. Below is an example of this:

     

    <% Response.ContentType = "text/vnd.wap.wml" %><?xml version="1.0" encoding="iso-8859-1"?>

    <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">

    <wml>

    <!-- THIS IS THE MAIN CARD OF THE DECK -->

    <card id="MainCard">

    <%

    id = Request.QueryString("id")

    dim conn

    dim rs

    dim strsql

    dim strconn

    strconn = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("LOCATION OF DATABASE")

    set conn = server.createobject("adodb.connection")

    conn.open strconn

    set rs = server.createobject("adodb.recordset")

    Query = "Select * from DATABASE TABLE Where ID ="&id&" ORDER BY ID"

    rs.open Query, conn

    rs.movefirst

    Do While NOt Rs.EOF

    %>

    <p align="left"><small><b><%=rs("Headline")%></b></small></p>

    <p align="left"><small><%=rs("Article")%></small></p>

    <%

    rs.movenext

    Loop 

    close everything

    rs.close

    set rs= nothing

    set conn = nothing

    %>

    <p align="left"><small><a href="PREVIOUS PAGE">Back</a></small></p>

    </card>

    </wml>

    Now you can try out your WAP site and link the new news section toyour WAP site. The next time you change your database your WAP sitewill now change along with your regular website. One of the best thingsyou can do when creating WAP sites is to keep it simple and if you areworking with databases keep them simple. It is also best to test yourWAP code first before implementing ASP otherwise it will get confusing.

    I hope this article has been of some use to you all and in my next Iwill be showing ways of how to improve to above code to make it evenmore dynamic!


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

    More Code Examples Articles
    More By aspfree

     

    IBM® developerWorks developerWorks - FREE Tools!


    NEW! Calling all CC Power Users – and those that would like to be!

    Join this Rational Talks to You teleconference, featuring Paul Boustany and Mark Krasovich, to speak to the experts about becoming a Rational ClearCase power user. Get a chance to ask your questions and learn tips and tricks for using Rational ClearCase in Agile development
    FREE! Go There Now!


    NEW! BlammoSplat: Build a community Web site of OpenLaszlo animations, Part 3: The community animation

    Learn to enable users to both rate existing animations and to combine existing animations into new snippets. This is the third in a series of three tutorials that chronicle the building of a site that enables collaborative discussion and animation building using Domino and OpenLaszlo.
    FREE! Go There Now!


    NEW! Evaluate IBM Rational Software Analyzer V7.0

    Download a free trial version of IBM Rational Software Analyzer Developer Edition V7.0 to identify bug defects earlier in the software development cycle. Rational Software Analyzer is an extensible software development solution that reduces the expense of bug-fixes by enabling static analysis code reviews and bug identification very early in the development cycle.
    FREE! Go There Now!


    NEW! Evaluate Rational Business Developer V7.1

    Visit IBM developerWorks to download a free trial version of IBM Rational Business Developer V7.1. Rational Business Developer offers rapid and simplified development of business applications and services through Enterprise Generation Language (EGL) tools, generating Java or mainframe solutions while shielding developers from technical complexities.
    FREE! Go There Now!


    NEW! Hello World: Monitor a simple business process using WebSphere Business Monitor V6.0.2

    This tutorial shows new users of IBM WebSphere Business Monitor Version 6.0.2 how to perform the "Hello World" equivalent for monitoring business process applications. It is intended to help you get familiar with the capabilities of the product.
    FREE! Go There Now!


    NEW! IBM Enterprise Modernization Sandbox for System z

    IBM Enterprise Modernization solutions help organizations evolve core IT systems towards modern architectures and technologies—reducing the burden of maintenance and freeing up resources to develop new business requirements and capabilities. With the IBM Enterprise Modernization Sandbox for System z you can evaluate IBM Enterprise Modernization solutions focused on five key areas: Assets, Architectures, Skills, Processes and Infrastructures, and Investment. Each solution is based upon real customer experiences and offers a proven path to get you started with your modernization projects.
    FREE! Go There Now!


    NEW! Krugle, developerWorks, and code search

    Ken Krugler, co-founder of code search company Krugle, and Laura Merling, vice president of Marketing and Business Development for Krugle, join to talk about the ins and outs of code search and what it means as a new feature for developerWorks users.
    FREE! Go There Now!


    NEW! Trial download: IBM Rational Method Composer V7.2

    Get a free trial download of the latest version of IBM Rational Method Composer V7.2 which helps you deliver customized yet consistent process guidance to your project teams and IT organization, and includes the latest version of IBM Rational Unified Process (RUP), which has provided process guidance to teams since 1996.
    FREE! Go There Now!


    NEW! Webcast: Accelerating Software Innovation with System z

    Attend this launch webcast with Scott Hebner, Vice President of IBM Rational Marketing and Strategy, where he will overview Rational’s new offerings and programs to help customers accelerate software innovation on System z. He will discuss how these solutions help organizations extend their core business processes toward modern architectures such as SOA and web technologies to deliver business improvements that stand the test of time.
    FREE! Go There Now!


    NEW! Webcast: Introducing the new Information Server and Solutions community: LeverageInformation

    User communities play an important role in communication and collaboration around products, solutions and other areas of special interest to members. Successful communities are able to provide the right mix of content and services to deliver a value proposition that resonates with each audience. Join Tom Inman, VP of Marketing for Information and Platform Solutions as he introduces the new LeverageINFORMATION community. During this webcast, learn about the value provided by the community and how customers and partners derive value from the community in addressing their own technical and business challenges.
    FREE! Go There Now!



    All FREE IBM® developerWorks Tools!

    CODE EXAMPLES ARTICLES

    - Bipartite Graphs
    - Connectivity in Graphs
    - The Ford-Fulkerson Algorithm
    - Critical Paths
    - The Bellman-Ford and Roy-Floyd Algorithms
    - Shortest Path Algorithms in Graphs
    - Minimum Spanning Tree
    - Articulation Edges and Vertexes
    - Circles and Connectivity in Graphs
    - Depth-First Search in Graphs
    - Breadth-First Search in Graphs
    - The Prufer Code and the Floyd-Warshall Algor...
    - An Insight into Graphs
    - Coding a Custom Object with WSC
    - Creating a Custom Object with WSC





    © 2003-2010 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek