View Full Version : how to build db for using in listboxes in ASP

10 May 2006, 04:21 PM
I want to have a database on a book where this is how it goes:

Chapter 1
-subtitle 1
-subtitle 2...
I have MSAccess 2000. How do you recommend me to build it? I want to use it with a combination of listboxes in ASP.

17 May 2006, 04:19 PM
Didn't you already post this ?

I'd do something like this depending on how different each level is

SectionID (primary Key)
ParentSectionID (foreign key)

data would be stored like this :

1 0 Preface
2 0 Introduction
3 2 -subtitle1
4 2 -subtitle2
5 0 Chapter 1
6 5 -subtitle 1
7 5 -subtitle 2...

To get all the top level sections you would do

SELECT * FROM tbl_Sections WHERE ParentSectionId = 0

An alternative aproach where you want differnt information depending on the level would be to havea separate table for the top level and sub levels.