Results 1 to 7 of 7

Thread: Dropdown

  1. #1
    Join Date
    Oct 2004
    Posts
    4

    Unanswered: Dropdown

    Hello guys,

    I have a problem entering data into database.
    I've got 3 dropdown boxes with multiple select feature. So users can choose more than one item in each dropdown. How can I get all of the selected items from all dropdowns into a database ? Please, pay attention that due to needs for some mathematical operations the datatypes of the fields where passed parameters will get in must be the INTEGER type.
    My application is on ASP platform and the database is MS Access.

  2. #2
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    well you select all the items that are posted, create a loop to cycle though them and then create an insert statement for each value you need to insert.

    You can't insert them all at once in a single insert statement (not that I am aware of anyway) unless you have a table structure that doesn't really mactch what you are suggesting.

  3. #3
    Join Date
    Oct 2004
    Posts
    4
    Thanks rokslide.

    Would you be so kind to drop a sample on this subject.
    Let's say that dropdowns are DROP1, DROP2, DROP3

    selected items IDs:
    DROP1 - 1, 4, 7
    DROP2 - 14, 24, 31
    DROP3 - 8, 9, 11

    Thank you in advance.

  4. #4
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    not really, not without more information on the data structure that you are talking about putting that data into.

    do you have three tables or one? Do you want to insert all of the first three values into a table and then the next three or what?

    Happy to help if you can give us more information.

  5. #5
    Join Date
    Oct 2004
    Posts
    4
    Sorry. You're right.

    I have got just one table with some fields like UserID, Date, Drop1, Drop2, Drop3 and etc.
    I want to have all selections made by specific user. Records owners can be recognized by UserID. So I would be able to sort data by UserID or make some calculations on the fields like DROP1 or DROP2 or DROP3.

    for instance, number of selected items IDs are different:
    DROP1 - 1, 4, 7, 8, 9
    DROP2 - 14, 24, 31
    DROP3 - 8, 9, 11, 23

  6. #6
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    Where is the user id coming from? If there another drop down for that?

    Basically with a list box that has multiple selections, when you make a request for the values you receive a collection of items, rather then just the one.

    So you would need to find the length of each collection and then iterate through the collections (preferably in a single loop) and build an array of sql strings.

    Then loop through the array and excute the sql strings against the database.

  7. #7
    Join Date
    Oct 2004
    Posts
    4
    There is a logon page. UserID goes through all other pages via Session variable.
    Can you drop an example on SQL query loops, please.

Posting Permissions

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