Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 28th, 2007, 02:45 PM
Registered User
 
Join Date: Aug 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default ASP / Sql question

Hi,

As a Web Design major, I am in no way an expert in programming and have taken on an approach of learn as you go. I started out thinking that an include file was the "coolest" thing in the world, but only now I am starting to begin to scratch the surface of ASP/Sql.

A friend of mine is having me make his web site for his restaurant as a favor. As with any restaurant website, they want to feature their menu online. This menu is rather large and has something like 120+ items on the menu. Instead of hard coding it all in html, I created an access database with 2 tables. A table that lists the category and then a table that has the menu items, prices, and a lookup field so I can pick the category. I am able to successfully connect to the database and display all the data on the page. However, I'm trying to categorize the page by the menu category. For instance, I want to have a bold heading that says "Beverages," and then have the beverages listed below it. I cheated a little and used "SQL View" in Access and I think I'm on the right track. I can get it to display 1 Category and all the items within that category, but I cannot figure out how to get all the categories to display with all of the items.

Below is the code that I used:

SQL = "SELECT tbl_category.tbl_category_menuItem, tbl_menu.*, tbl_menu.tbl_menu_category FROM tbl_category INNER JOIN tbl_menu ON tbl_category.ID = tbl_menu.tbl_menu_category WHERE (((tbl_menu.tbl_menu_category)=1));"
    Set tblMenu = Server.CreateObject("ADODB.recordSet")
    tblMenu.Open SQL, Conn, 1, 3

    count = 0
    Response.Write("<table align=""center"" class=""standard"" cellspacing=""0"" cellpadding=""3""><tr>")
        Do While NOT tblMenu.EOF
        count = count + 1
        n = count mod 2
            %>
                      <td width="45%"><%=tblMenu("tbl_menu_name")%></td>
                        <td align="center" width="5%"><%=tblMenu("tbl_menu_price")%></td>
                        <td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
            <%
            If (n = 0) Then
                Response.Write("</tr><tr>")
            End If
            tblMenu.Movenext
        Loop
    Response.Write("</table>")
    tblMenu.Close
    Set tblMenu = Nothing

Am I even on the right track? Any help or suggestions would be really appreciated. Thanks for your help and time.

Joe






Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL Question psnow1985 ASP.NET 2.0 Basics 23 March 21st, 2008 11:48 AM
ASP/SQL question dathomps Classic ASP Databases 5 December 4th, 2007 07:38 PM
A SQL question pankaj_daga Access 5 December 5th, 2005 04:37 PM
Time Question on SQL/ASP mg1966 Classic ASP Databases 4 January 24th, 2005 11:48 PM
Sql-question boson SQL Language 2 July 3rd, 2004 06:39 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.