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! Build Web services with transport-level security using Rational Application Developer V7, Part 1: Build Web services and Web services clients

    Build secure Web services with transport-level security using IBM Rational Application Developer V7 and IBM WebSphere Application Server V6.1. Follow this three-part series for step-by-step instructions about how to develop Web services and clients, configure HTTP basic authentication, and configure HTTP over SSL (HTTPS). This first part of the series walks you through building a Web service for a simple calculator application. You generate and test two different types of Web services clients: a Java Platform, Enterprise Edition (Java EE) client and a stand-alone Java client. You also handle user-defined exceptions in Web services.
    FREE! Go There Now!


    NEW! Download IBM Data Studio V1.1

    Visit IBM developerWorks to download the latest trial version of IBM Data Studio V1.1 at no cost. IBM Data Studio is a comprehensive data management solution that helps you effectively design, develop, deploy and manage your data, databases, and database applications throughout the data management life cycle utilizing a consistent and integrated user interface. Unlike other client-side data management solutions that focus on only one aspect of the application lifecycle or database administration, Data Studio complements the Rational Software Delivery platform, providing unparalleled flexibility for a heterogeneous data server environment across platforms.
    FREE! Go There Now!


    NEW! Hello World: WebSphere Service Registry and Repository

    Manage, govern, and share services across your organization by using WebSphere Service Registry and Repository. Follow the hands-on exercises to learn how to navigate the Web interface to publish, find, reuse, and update services.
    FREE! Go There Now!


    NEW! Integrating XML into Your Enterprise Using Data Federation

    XML has become a common way of storing business data as flat files and many data server vendors including IBM have provided ways to store this data within relational database systems. Increasingly collections of XML files are accessed like databases using an xQuery and other XML standard mechanisms. Businesses find the need to combine the traditional tabular structured data with XML formatted data. In this webcast, you’ll learn about IBM’s WebSphere Federation Server technology, which provides users with the ability to integrate these two data formats.
    FREE! Go There Now!


    NEW! Software Change and Configuration Management Solution Guidelines

    This whitepaper provides areas to consider when evaluating any software configuration management solution. It addresses how the IBM solutions (Rational ClearCase and Rational ClearQuest) meet the needs and requirements of both project leaders and developers to provide successful Software Change and Configuration Management.
    FREE! Go There Now!


    NEW! Trial download: IBM Rational Manual Tester V7.0.1

    Try the latest version of IBM Rational Manual Tester V7.0.1 by downloading a free trial from IBM developerWorks. This manual test authoring and execution tool promotes test step reuse to reduce the impact of software change on testers and business analysts and addresses the needs of teams performing at least a portion of their testing manually.
    FREE! Go There Now!


    NEW! Try IBM Rational Asset Manager V7.0 online!

    You can now evaluate IBM Rational Asset Manager V7.0 online without installing or configuring it on your own system! Rational Asset Manager helps create, modify, govern, find, and reuse any type of development assets, including SOA and systems development assets. Rational Asset Manager helps you reduce software development costs and improve quality by facilitating the reuse of all types of software development-related assets. Visit developerWorks to learn more about this product and register to explore its capabilities online.
    FREE! Go There Now!


    NEW! Webcast: Quickly provide customized, integrated user interfaces with Lotus Notes 8

    IBM Lotus Notes 8 provides a wide range of developers the ability to provide customized, integrated user interfaces via composite applications and via custom sidebar and toolbar plug-ins. This webcast provides you with tips and techniques to use with out-of-the-box capabilities of Lotus Notes 8, and survey how you can share useful components within your own company and within a larger community.
    FREE! Go There Now!


    NEW! Whitepaper: Achieving consistency between business process models and operational guides

    Explore how Rational and WebSphere software enable enterprise documentation in SOA environments. Specifically, a new integration between IBM WebSphere® Business Modeler and IBM Rational® Method Composer software can help technical writers more easily keep enterprise operations manuals in sync with changes that are made to business processes, resulting in more accurate and timely documentation that benefits the entire enterprise.
    FREE! Go There Now!


    Refresh! IBM Rational Systems Development Solution eKit

    With IBM Rational Systems Development Solution, you can deliver products faster with higher quality. Within this kit, Read the “Model Driven Systems Development” white paper to see how to improve product quality and communication. Then check out the rest of the e-Kit to learn more about important topics that can affect the success of any software project through customer examples, tutorials, informative Webcasts, and best practices for designing, building and managing systems. From start to finish, at every stage in your projects, Rational Systems Development Solution can help your company reach its full potential.
    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-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek