If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
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, 02: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, 02:23
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
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, 03: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, 03:09
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
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, 03: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, 19:06
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
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, 02: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

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