473,387 Members | 1,779 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

probably easy for you, but . . .

Over the years, believe it or not, I have never used Multiple select boxes.
Now, can someone tell me where I can see some sample code for how to get
data from there and use it? Specifically, the select box will list the first
and last names of employees (this is Intranet), and I want to take the
employee ID (which would be the value of each selection) and use it on the
next page to go back into the employee table of the database and pull up
their email address, send emails using CDO, store the fact that an email was
sent into the database, etc.

I do better with sample code than philosophical explanations.

thanks
Jul 19 '05 #1
3 1616
A multiple select box gives a comma-separated list of chosen values. So
something as simple as:

sql = "SELECT * FROM table WHERE employeeID IN (" &
request.form("employeeID") & ")"

Now, it would be more complicated if these were strings, because you'd have
to insert delimiters. And don't forget earlier discussions about preventing
SQL injection...

A
"middletree" <mi********@htomail.com> wrote in message
news:Oo**************@TK2MSFTNGP10.phx.gbl...
Over the years, believe it or not, I have never used Multiple select boxes. Now, can someone tell me where I can see some sample code for how to get
data from there and use it? Specifically, the select box will list the first and last names of employees (this is Intranet), and I want to take the
employee ID (which would be the value of each selection) and use it on the
next page to go back into the employee table of the database and pull up
their email address, send emails using CDO, store the fact that an email was sent into the database, etc.

I do better with sample code than philosophical explanations.

thanks

Jul 19 '05 #2
> Ok, so if a user selects two people from the list, and the values are 100
and 200, then the Select statement would be

sql = "SELECT * FROM table WHERE employeeID IN ("100,200")"
Well, close... the embedded quotes wouldn't be there.
And then I would have to find a way to grab the email address (or whatever
info I need) from that table for both employee 100 and employee 200. Can you guide me on this? This is the part about which I am most confused.


sql = "SELECT employeeID, emailAddress FROM table WHERE employeeID IN (100,
200)"
set rs = conn.execute(sql)
do while not rs.eof
response.write "EmployeeID " & rs(0) & " e-mail:"
response.write rs(1) & "<br>"
rs.movenext
loop
Jul 19 '05 #3
OK, that makes sense. I appreciate it!
"Aaron Bertrand - MVP" <aa***@TRASHaspfaq.com> wrote in message
news:eG**************@tk2msftngp13.phx.gbl...
Ok, so if a user selects two people from the list, and the values are 100 and 200, then the Select statement would be

sql = "SELECT * FROM table WHERE employeeID IN ("100,200")"
Well, close... the embedded quotes wouldn't be there.
And then I would have to find a way to grab the email address (or whatever info I need) from that table for both employee 100 and employee 200. Can

you
guide me on this? This is the part about which I am most confused.


sql = "SELECT employeeID, emailAddress FROM table WHERE employeeID IN

(100, 200)"
set rs = conn.execute(sql)
do while not rs.eof
response.write "EmployeeID " & rs(0) & " e-mail:"
response.write rs(1) & "<br>"
rs.movenext
loop

Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: rbt | last post by:
This function is intended to remove unwanted files and dirs from os.walk(). It will return correctly *IF* I leave the 'for fs in fs_objects' statement out (basically leave out the entire purpose of...
3
by: Nicke | last post by:
Hi, I've used vb.net for 3 hours(!) now and have probably a very easy question. In my VB6 programs I use For Each Cell in Range... very often which not seems to work in vb.net. Ex. Dim Cell...
7
by: Bastard_Toadflax | last post by:
I'm making a database for a work project, and am having some difficulties (note: I am at the novice end of the MS Access users spectrum). Basically, what I have to do is make a list of managers in...
3
by: David Mills | last post by:
Hello, looking for some input on how to do this query. (I'm using Access) John Doe 123 Main St Chicago 123 John Doe 123 Main St Chicago 456 John Doe 123 Main St Chicago 789 Given the...
5
by: greg | last post by:
I'm sure this is easy - if someone could give me a push in the right direction I would apprieciate it! If you have multiple categories CatID - NAME - ParentID 1 root 0 2 ...
1
by: jm | last post by:
Easy probably, please read on. I know some of you have commented already about some of my socket question. I appreciate that. I have a Form1: static void Main() { Application.Run(new...
6
by: Tim Geiges | last post by:
I am trying to open an image in a little image viewer I wrote(it has its own file explorer but I want it to also open from Windows Explorer) When I select an image from widows explorer and use...
5
by: DbZ | last post by:
Hi - i'm new to the regex thing - and trying to learn it to myself - Can someone please explain to me what the following line does - value.replace(/\s+$/g,"") I can kinda figure out its...
409
by: jacob navia | last post by:
I am trying to compile as much code in 64 bit mode as possible to test the 64 bit version of lcc-win. The problem appears now that size_t is now 64 bits. Fine. It has to be since there are...
1
by: paulf.johnson | last post by:
Hi, For some reason, my brain has gone to mush on a couple of things. Any help would be appreciated. I have an array and a field passed into a function (call it $v) which is a string composed...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.