Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > categories

Reply
Thread Tools

categories

 
 
jeef
Guest
Posts: n/a
 
      11-21-2003
Im setting up a database driving store running off of a sql database
and asp.
I want to have categories with subcategories. That way a customer can
borrow down through my site to buy a product.
For example: going to a grocery store your looking for cake.
categories would be Groceries -> Bakery -> Cake -> Chocolate -> Happy
Birthday or
Groceries -> bakery -> Cake -> White -> Congratulations

How should i setup the database and with asp how would i list the
categories so that whenever the customer comes to my site it would say
Bakery Snacks
Cake Chips
Donuts Pretzels
Rolls Oreos


Dairy
Milk
Cheese
Yogurt
 
Reply With Quote
 
 
 
 
Chris Hohmann
Guest
Posts: n/a
 
      11-21-2003
"jeef" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> Im setting up a database driving store running off of a sql database
> and asp.
> I want to have categories with subcategories. That way a customer can
> borrow down through my site to buy a product.
> For example: going to a grocery store your looking for cake.
> categories would be Groceries -> Bakery -> Cake -> Chocolate -> Happy
> Birthday or
> Groceries -> bakery -> Cake -> White -> Congratulations
>
> How should i setup the database and with asp how would i list the
> categories so that whenever the customer comes to my site it would say
> Bakery Snacks
> Cake Chips
> Donuts Pretzels
> Rolls Oreos
>
>
> Dairy
> Milk
> Cheese
> Yogurt


What database/version? If it's MS SQL Server, there's an article in
Books Online (BOL) under the heading "Expanding Hierarchies" that does
what you're looking for.

HTH
-Chris Hohmann


 
Reply With Quote
 
 
 
 
Navid
Guest
Posts: n/a
 
      11-21-2003
hi,
you can use this ...

tbl_categories
=======================================
id(autonumber),name(text 255),up_cat_id(Number - which is the ID of up
Category)
=======================================
<%
cat=request("cat") ' current category
strsql="Select * From tbl_categories where up_cat_id=" & cat & " order by
id"
objrs.open strsql, objconn,3,1
count=objrs.recordcount\2+1
if count=objrs.recordcount/2+1 then count=count-1
%>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse:
collapse; font-size:8pt" bordercolor="#111111" width="100%"
id="AutoNumber1">
<tr>
<td width="50%" valign="top">
<%
for i=1 to count
if not objrs.eof then
strsql1="Select * From tbl_categories where up_cat_id=" & objrs("id") & "
order by id"
objrs1.open strsql1, objconn,3,1
%>
<p><a href="./?cat=<%=objrs("id")%>" style="text-decoration:
none"><b><%=objrs("name")%></b></a><br>
<%
do while not objrs1.eof
%>
-<a href="./?cat=<%=objrs1("id")%>" style="text-decoration: none">
<%=objrs1("name")%></a><br>
<%
objrs1.movenext
loop
objrs1.close
objrs.movenext
end if
next
%>
</td><td width="50%" valign="top">
<%
for i=1 to count
if not objrs.eof then
strsql1="Select * From tbl_categories where up_cat_id=" & objrs("id") & "
order by id"
objrs1.open strsql1, objconn,3,1
%>
<p><a href="./?cat=<%=objrs("id")%>" style="text-decoration:
none"><b><%=objrs("name")%></b></a><br>
<%
do while not objrs1.eof
%>
-<a href="./?cat=<%=objrs1("id")%>" style="text-decoration: none">
<%=objrs1("name")%></a><br>
<%
objrs1.movenext
loop
objrs1.close
objrs.movenext
end if
next
%>
</td> </tr>

</table>

===============================================
Nav!d
Free Weblog Management System @
http://www.asp-rider.com/
(But in Persian)
===============================================

"Chris Hohmann" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> "jeef" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed) om...
> > Im setting up a database driving store running off of a sql database
> > and asp.
> > I want to have categories with subcategories. That way a customer can
> > borrow down through my site to buy a product.
> > For example: going to a grocery store your looking for cake.
> > categories would be Groceries -> Bakery -> Cake -> Chocolate -> Happy
> > Birthday or
> > Groceries -> bakery -> Cake -> White -> Congratulations
> >
> > How should i setup the database and with asp how would i list the
> > categories so that whenever the customer comes to my site it would say
> > Bakery Snacks
> > Cake Chips
> > Donuts Pretzels
> > Rolls Oreos
> >
> >
> > Dairy
> > Milk
> > Cheese
> > Yogurt

>
> What database/version? If it's MS SQL Server, there's an article in
> Books Online (BOL) under the heading "Expanding Hierarchies" that does
> what you're looking for.
>
> HTH
> -Chris Hohmann
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
rss validation error - how are categories set up? johnsonholding@yahoo.com HTML 3 02-22-2006 12:43 AM
List categories AND records at once... Řyvind Isaksen ASP .Net 1 10-17-2005 01:31 AM
Ecommerce Sub Categories Frank Bishop ASP .Net 0 01-21-2005 01:58 PM
ASP .NET Categories/(Count) Question Chad A. Beckner ASP .Net 2 06-16-2004 08:38 PM
managing hierarchical data - categories Neil McGuigan ASP .Net 1 03-06-2004 10:51 AM



Advertisments