Results 1 to 2 of 2

Thread: how to build db for using in listboxes in ASP

  1. #1
    Join Date
    Feb 2006
    Posts
    5

    how to build db for using in listboxes in ASP

    I want to have a database on a book where this is how it goes:
    Code:
    Preface
    Introduction
    -subtitle1
    -subtitle2
    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.

  2. #2
    Join Date
    Jan 2006
    Location
    Manchester England UK
    Posts
    225
    Didn't you already post this ?

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

    tbl_Section
    SectionID (primary Key)
    ParentSectionID (foreign key)
    SectionName

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •