pulling stuff from comma-delimited field

Discussion in 'ASP General' started by middletree, Aug 13, 2003.

  1. middletree

    middletree Guest

    I have a page where I allow the user to select one or more names of
    employees to send an email to, which is sent automatically when the form is
    submitted. I have a field called EmailSentTo, and if you sent it to Joe
    Smith, then it stores the employee's number, 200, which is the PK of the
    Employee table.

    And there is, of course, another page which displays all the information
    from that form I just submitted, so I want to display this new thing I
    added, the name of the person I sent an email to. So far, no problem.

    The thing gets complicated when I choose to send the email to more than one
    person. In that case, I select Joe Smith and Mary Jones, and it enters
    "200,100" into the field. A comma-delimited set of empoloyee IDs.

    I realize that in order to display this, I would need some sort of loop, but
    I'm not sure about how to do this. I can do a loop which pulls different
    records from a table, but this is pulling several things from one field of
    one record. Anyone got any sample code?

    (BTW, I know that this is essentially a one-to-many, and I should simply
    break it down to another table, but I was trying to avoid that. But I will
    if that's the best thing to do)
     
    middletree, Aug 13, 2003
    #1
    1. Advertising

  2. I am not sure I understand you correctly,

    but you can use the split() function to split a string "100,200, 300" into
    an array .
    Or if you use that in a select statement use can use
    select * from table where EmployeeID in (100,200,300)
    then you can loop through that...

    HTH

    "middletree" <> wrote in message
    news:...
    > I have a page where I allow the user to select one or more names of
    > employees to send an email to, which is sent automatically when the form

    is
    > submitted. I have a field called EmailSentTo, and if you sent it to Joe
    > Smith, then it stores the employee's number, 200, which is the PK of the
    > Employee table.
    >
    > And there is, of course, another page which displays all the information
    > from that form I just submitted, so I want to display this new thing I
    > added, the name of the person I sent an email to. So far, no problem.
    >
    > The thing gets complicated when I choose to send the email to more than

    one
    > person. In that case, I select Joe Smith and Mary Jones, and it enters
    > "200,100" into the field. A comma-delimited set of empoloyee IDs.
    >
    > I realize that in order to display this, I would need some sort of loop,

    but
    > I'm not sure about how to do this. I can do a loop which pulls different
    > records from a table, but this is pulling several things from one field of
    > one record. Anyone got any sample code?
    >
    > (BTW, I know that this is essentially a one-to-many, and I should simply
    > break it down to another table, but I was trying to avoid that. But I will
    > if that's the best thing to do)
    >
    >
     
    Gerhard Pretorius, Aug 13, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Yama

    Comma Delimited

    Yama, Dec 15, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    411
    Ken Cox [Microsoft MVP]
    Dec 16, 2003
  2. Luis Esteban Valencia

    Read Comma Delimited File

    Luis Esteban Valencia, Jul 27, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    2,828
    Paul Clement
    Jul 27, 2005
  3. Edward A Thompson

    JavaMail MimeMessage - comma delimited?

    Edward A Thompson, Oct 8, 2003, in forum: Java
    Replies:
    9
    Views:
    5,715
    GaryM
    Oct 10, 2003
  4. David Fraser
    Replies:
    1
    Views:
    311
    Paul Rubin
    Jul 1, 2004
  5. RyanL
    Replies:
    6
    Views:
    715
    Paul McGuire
    Aug 28, 2007
Loading...

Share This Page