one to many relation writing to Access database

Ask a Question related to ASP, Design and Development.

  1. #1

    Default Re: one to many relation writing to Access database

    In article <EYcMa.517516$122.49025169@amsnews02.chello.com> ,
    [email]marco@alting-multimedia.nl[/email] says...
    > Hi
    >
    > I know how to display one to many relationships between tables, but now I
    > want to be able to write a record that has a one to many relationship with
    > another table. What I want to achieve is the following:
    >
    > I have a input form which holds a dropdown list from which multiple items
    > can be selected. The dropdown list is populated from a table. So if a user
    > selects multiple items, how would I write that to the main table so it will
    > hold the relation to the table of the list?
    >
    It sounds like what you want is really a many to many relationship where
    a user can be related to many items, and of course an item may be
    related to many users.

    If this is true, you need a "link" table that associates these tables
    with their unique id's.

    table "items" has columns id, itemname
    table "users" has columns id, username
    table "items_users" has columns itemid, userid

    In this case, you would add multiple records to items_users - one for
    each item that the user selected from the list.

    items
    id itemname
    1 Monitor
    2 Case
    3 Keyboard

    users
    id username
    1 mmouse
    2 gnoir
    3 tjones

    items_users
    itemid userid
    1 1
    1 2
    2 1
    3 2
    3 3

    In this example:
    User mmouse has a Monitor and a Case
    User gnoir has a Monitor and a Keyboard
    User tjones has a Keyboard


    --

    Remove NOT from email address to reply. AntiSpam in action.
    Dan Brussee Guest

  2. Similar Questions and Discussions

    1. Writing to a Database using Flash
      Hi, I am creating e-learning material that will be accessed online by students. Is there anyway that Flash can write to a database to tell us how...
    2. Writing to Oracle Database using Flex
      Hello gurus, I have created a Flex form application in Flex 1.5 This form application has several text input controls. The logic is, whatever...
    3. Writing into the database on the internet
      Hi! I have an application that runs on the internet that works with asp and access. When I request info from the database, it works fine, but when I...
    4. C function taking a relation and returning a similar relation.
      Hi, Please CC me as I'm not on the list. I'm trying to write a closed frequent itemset data mining custom function for postgresql. The optimal...
    5. need help writing database entires to file
      I have used dreamweaver to do a lot of php "programming" but now I need to write a real php function. I have a hosted mysql database that I need...
  3. #2

    Default Re: one to many relation writing to Access database

    Very well put Dan, I second your thought.

    -Andrew

    * * * Sent via DevBuilder [url]http://www.devbuilder.org[/url] * * *
    Developer Resources for High End Developers.
    Andrew Durstewitz Guest

  4. #3

    Default Re: one to many relation writing to Access database

    Thanks for the quick answer. While reading it I think I never had to
    build a many to many relation. I'm now wondering what the SQL would look
    like for both writing the information to the tables and to display the
    information again from the tables...

    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Marco Alting Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139