473,651 Members | 2,861 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Display Catagories into Subcategories from database ?

Fary4u
273 Contributor
Hi every one any body can help me in this regards ? i don't know how to do that
how do i convert following code into sub catagory ?
like . . .
Expand|Select|Wrap|Line Numbers
  1. Computer
  2.     Mainboards
  3.     Keyboards
  4.     Mouse
  5. Process
  6.     Intel
  7.     AMD
  8.  
these catagories i've got in database
Expand|Select|Wrap|Line Numbers
  1. <%
  2.     Dim Conn, rsCatalog
  3.     Set Conn = Server.CreateObject("ADODB.Connection")
  4.     Conn.Open ConString
  5.     Set rsCatalog = Conn.Execute("SELECT * FROM catalogs")
  6.         While Not rsCatalog.EOF
  7.  
  8.     Response.Write rsCatalog("catalogID")
  9.         rsCatalog.MoveNext
  10.         Wend
  11.     rsCatalog.Close
  12.     Set rsCatalog = Nothing
  13. %>
  14.  
but when i display it's just like not with subcatagories ?
Expand|Select|Wrap|Line Numbers
  1. Computer
  2. Mainboards
  3. Keyboards
  4. Mouse
  5. Process
  6. Intel
  7. AMD
  8.  
but i want just main 2 catagories like Computer & Process then any body click on the Computer section then it's bring subcatagories ?
Nov 9 '07 #1
4 1437
markrawlingson
346 Recognized Expert Contributor
There are many ways to do something but the easiest would be to define whether the item is a top level item or a sub category item at a database level. In other words, Put a bit value in your database table. If it's top level item define a value of false, if it's a sub-level item define a value of true.

Then check the value as you loop through each record..

Expand|Select|Wrap|Line Numbers
  1. If rs("bSubCategory") = False Then 'Boolean value of false, it is a top level item, simply write it on the page
  2.    Response.Write rs("ID")
  3. Else 'Boolean value of true, it's a sub-level item, put a blockquote around it to indent it to visually show it's a sub-level item.
  4.    Response.Write "<blockquote>"
  5.    Response.Write rs("ID")
  6.    Response.Write "</blockquote>"
  7. End If
  8.  
Sincerely,
Mark
Nov 11 '07 #2
Nicodemas
164 Recognized Expert New Member
Please read a recent post of mine to my personal blog about programming:

Hierarchical Data Using SQL

It explains a common database table structure and some sample queries in regards to hierarchical data.
Nov 28 '07 #3
Fary4u
273 Contributor
Hi

i still not figer it out can you plz see my code & figer it out how the best way to find that

thaxxxxxxxxxxxx xxxxxxxxxx
Dec 26 '07 #4
Fary4u
273 Contributor
i still not figer it out can you plz see my code & figer it out how the best way to find that
Jan 2 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
13478
by: Brian Murphy | last post by:
I have a php-based yahoo-like web directory.I wanna give webmasters the possiblity to integrate my whole directory in their websites with their own formatting.I wanna this inclusion to be possible to all kinds of websites (ASP,PHP,... or just HTML).There are basically two files in my website: -index.php : shows the main categories along with 3 sample subcategories. -index1.php : displays the subcategories and sites of categories (exactly...
10
13442
by: DettCom | last post by:
Hello, I would like to be able to display or hide fields based on whether a specific Yes/No radio button is selected. This is in conjunction with a posting a just made here in the same group related to checkboxes. Thanks!!!
0
1320
by: Paul Hendryx | last post by:
I have the table structure: CREATE TABLE . ( IDENTITY (1, 1) NOT NULL , NOT NULL , NULL , (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ) ON GO
1
1808
by: vinayg | last post by:
how can i search subcategory wise for a particular category,i want to display items.suppose user selected a particular category.I want to display all items in that category + its subcategories. this is my table structure with 3 tables. i need a sql query http://www.ukrate.com/db.jpg
1
2400
by: jmDesktop | last post by:
I have read various things on subcategories. If there is only one subcategory for a main category it doesn't seem too bad, just another table, but I was wondering what some of you might recommend as the best way to created subcategories. What if a subcategory has another subcategory? I have read about sql adjacency models, but wanted a real world example to see if this is necessary. thanks in advance.
2
1156
by: mbumbalough | last post by:
I am working on building a dynamic menu that searches the database for the manufacturer ID to get the product catagories for the submenu. The problem that I am having right now is that when searching the Products table, there are multiple entries from the same manufacturer thus showing multiple instances of the same manufacturer in the menu. What I am trying to do is search the Products database table and get all of the Manufacturer IDs then...
2
1832
by: DotNetNewbie | last post by:
Hello, I need to display a list of categories on the left side of a page, and I am confused how I would do this using a List Control (as appose to weaving my own HTML on the server side). My HTML should look like: <ul>
2
2660
by: itpvision | last post by:
Hello, I have a link navigation of categories retrieved from the database, while I know how to display subcategories based on category link clicked with classical approach, I want to do this with ajax, The problem is with the classical style,I know the GET sent and the row im in with the category, so by simple comparison, I know how to display the subcategories under its parent category, but with ajax, I cannot know the GET and compare...
4
1645
AaronL
by: AaronL | last post by:
Hello, I am developing an e-commerce system and I want to be able to create catagories and subcatagories for items. I have the basics down however I may be making things too complicated. First I select a parent catagory and the page sucessfully brings me to the subcatagory screen, however anything past that, the catagory id variable is not being passed back to the application. Here is the code, hopefully someone can understand what I'm...
0
8357
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8803
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8700
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8581
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7298
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6158
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4144
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4285
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2701
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.