473,414 Members | 1,686 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

Display Catagories into Subcategories from database ?

Fary4u
273 100+
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 1429
markrawlingson
346 Expert 100+
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 Expert 100+
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 100+
Hi

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

thaxxxxxxxxxxxxxxxxxxxxxx
Dec 26 '07 #4
Fary4u
273 100+
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
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...
10
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...
0
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
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. ...
1
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...
2
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...
2
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...
2
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...
4
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.