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  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Dedicated Servers 
Actuate Whitepapers 
Moblin 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
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 / 17
    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

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    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! Addressing software-as-a-service challenges using Tivoli security and WebSphere solutions

    Building a software-as-a-service solution requires addressing a few key technical challenges. In this webcast, we'll focus on the role of IBM Tivoli Directory Server and WebSphere Portlet Factory in creating a Software as a Service solution. We will demonstrate how to use Tivoli Directory Server to prevent the user population of one tenant from accessing the virtual portal and portlet components of another tenant. We will also use the dynamic profile capability of WebSphere Portlet Factory to create multiple highly customized applications from one code base.
    FREE! Go There Now!


    NEW! Download IBM WebSphere Portal V6.1 beta code

    Download the IBM WebSphere Portal V6.1 beta code and learn more about the rich features and enhancements in IBM WebSphere Portal V6.1. WebSphere Portal provides a composite application or business mashup framework and the advanced tooling needed to build flexible, SOA-based solutions, and scalability to meet the needs of any size organization.
    FREE! Go There Now!


    NEW! Download the free Web Application Security eKit

    Discover how IBM Rational AppScan Standard Edition can help you detext vulnerabilities in your web applications in the Web Application Security eKit. IBM Rational AppScan is a leading suite of automated web application security solutions that scan and test for common Web application vulnerabilities. The new Web Application Security eKit provides you with valuable resources, including white papers, demos, and additional information on the benefits of testing your Web applications.
    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: 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! 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! 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! Trial download: IBM Rational Tester for SOA Quality V7.0.1

    Get a free trial download of the latest version of IBM Rational Tester for SOA Quality V7.0.1, a functional and regression testing tool that enables the creation, comprehension, modification and execution of testing GUI-less Web services.
    FREE! Go There Now!


    NEW! Using IBM Rational Developer for System z and IBM Rational ClearCase together to manage application development

    Whether you are creating new applications or modifying existing ones, managing integration of new components with traditional z/OS elements is a critical part of building and deploying modern applications. Listen to this webcast to see how IBM can help you optimize your development process using an IDE like Rational Developer for System z that integrates with management tools, such as ClearCase to manage your application development on mainframes.
    FREE! Go There Now!


    NEW! Webcast: Calling All Testers! Find Application Vulnerabilities Early in the Development Process Where they are Easier to Fix and Less Risky to your Business

    In this webcast, IBM Rational will discuss the importance of Web application security and will share techniques and best practices to introduce application security testing into current QA processes including: understanding common security vulnerabilities and techniques to integrate security testing with defect tracking and remediation systems in an effort to safeguard sensitive online information.
    FREE! Go There Now!



    All FREE IBM® developerWorks Tools!

    CODE EXAMPLES ARTICLES

    - Handling Animations and Bitmaps Using GDI+ f...
    - Download a Web Page using the WebClient
    - Creating a Chart using Data from a Database ...
    - The Basics of Charting with the MS Chart Con...
    - Searching Body Text with textRange: Enter th...
    - Searching Body Text with textRange: Building...
    - Searching Body Text with textRange, part 1: ...
    - First Steps in Programming
    - Programming in C
    - Quick Introduction to ASF,ASX, and Networkin...
    - SatView: Pointer Perfect, Part 2: Constructi...
    - SatView: Pointer Perfect, Part 1
    - Style Case Studies: Construction Unions
    - Creating an Engine for Games for Windows
    - Style Case Studies: Generic Callbacks





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway