ASP
  Home arrow ASP arrow Page 4 - Calorie Counter Using WAP and ASP
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Moblin 
JMSL Numerical Library 
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? 
ASP

Calorie Counter Using WAP and ASP
By: Tim Haight
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 21
    2004-02-23

    Table of Contents:
  • Calorie Counter Using WAP and ASP
  • Hosting
  • Index.wml
  • Application Deconstruction: Search.asp

  • 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


    Calorie Counter Using WAP and ASP - Application Deconstruction: Search.asp


    (Page 4 of 4 )

    This file contains the DSN-less connection, a SQL query, and the results. Note that the SQL query uses a like clause. This allows you to enter part of a food name and get back every food that contains that search string.  This feature is useful for any type of SQL query where the exact search string is vague.

    <%@ Language = "JScript"; %><% Response.ContentType = "text/vnd.wap.wml";
    %><?xml version="1.0"?>
    <!-- #include file="adojavas.inc" -->
    <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.2//EN"
                         "http://www.wapforum.org/DTD/wml_1.2.xml">

    <wml>
       <card id="card1" title="Food Results">
          <p>
             Food Search Results<br/>
    <%

    // dsn-less connection to food.mdb

       conn = Server.CreateObject("ADODB.Connection");
       rs   = Server.CreateObject("ADODB.Recordset");

       conn.Open("DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" +
                 Server.MapPath("Food.mdb") + ";");

    // create a string to hold the SQL query
       sqlQuery = "SELECT * FROM tblFoods where Description like '%" + Request.QueryString("Food") + "%' ORDER BY DESCRIPTION";


    // execute the query on the database
       rs.Open(sqlQuery, conn, adOpenForwardOnly, adLockReadOnly, adCmdText);

       while (!rs.EOF)
       {
          Response.Write("Description: ");
          Response.Write(rs("Description") + "<br/>");
          Response.Write("Serving: ");
          Response.Write(rs("Unit") + "<br/>");
          Response.Write("Fat: ");
          Response.Write(rs("Fat") + "<br/>");
          Response.Write("Calories: ");
          Response.Write(rs("Calories") + "<br/>");
          Response.Write("Carbs: ");
          Response.Write(rs("Carb") + "<br/>");
          Response.Write("Cholesterol: ");
          Response.Write(rs("Cholesterol") + "<br/>");
          Response.Write("-----------------");
          Response.Write("<br/>");
          rs.MoveNext();
       }
       conn.Close();
    %>
          </p>
       </card>
    </wml>

    After these files are uploaded to the hosting server, you should be able to view them with any WAP enabled device, emulator, or browser. Now, you can’t use the “well, I didn’t know that the hamburger had 700 calories” excuse. Have fun, and stay healthy! 


    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.

     

    ASP ARTICLES

    - Central Scoreboard with Flash and ASP
    - Calorie Counter Using WAP and ASP
    - Creating PGP-Encrypted E-Mails Using ASP
    - Be My Guest in ASP
    - Session Replacement in ASP
    - Securing ASP Data Access Credentials Using t...
    - The Not So Ordinary Address Book
    - Adding and Displaying Data Easily via ASP an...
    - Sending Email From a Form in ASP
    - Adding Member Services in ASP
    - Removing Unconfirmed Members
    - Trapping HTTP 500.100 - Internal Server Error
    - So Many Rows, So Little Time! - Case Study
    - XDO: An XML Engine Class for Classic ASP
    - Credit Card Fraud Prevention Using ASP and C...






    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
    Stay green...Green IT