Many people are more conscious of what they eat than ever before. (I count myself as a member of that club). The biggest challenge faced by many in the quest for a healthier lifestyle is the ubiquitous “lack of time” excuse. To help out, I have created a simple WAP application that allows for one to search for different foods and get related nutritional information, based on data from the American Diabetes Association. In this article, I’ll go over the creation of the application, and in the process, make you a little bit more health conscious.
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.
// 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);
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.