Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Dropdown

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-11-04, 03:01
tkaz tkaz is offline
Registered User
 
Join Date: Oct 2004
Posts: 4
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.
Reply With Quote
  #2 (permalink)  
Old 10-11-04, 03:23
rokslide rokslide is offline
Coffee Minion
 
Join Date: Nov 2003
Location: Sydney
Posts: 1,515
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.
Reply With Quote
  #3 (permalink)  
Old 10-11-04, 04:00
tkaz tkaz is offline
Registered User
 
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.
Reply With Quote
  #4 (permalink)  
Old 10-11-04, 04:09
rokslide rokslide is offline
Coffee Minion
 
Join Date: Nov 2003
Location: Sydney
Posts: 1,515
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.
Reply With Quote
  #5 (permalink)  
Old 10-11-04, 04:20
tkaz tkaz is offline
Registered User
 
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
Reply With Quote
  #6 (permalink)  
Old 10-11-04, 20:06
rokslide rokslide is offline
Coffee Minion
 
Join Date: Nov 2003
Location: Sydney
Posts: 1,515
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.
Reply With Quote
  #7 (permalink)  
Old 10-12-04, 03:45
tkaz tkaz is offline
Registered User
 
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.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On