Listbox database insert

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Big E

    Listbox database insert

    I'm using ASP.Net and SQL Server 2000.
    I have a Listbox that users can select multiple values. Selection Mode =
    Multiple.
    The multiple values are associated with one record. I need to insert into
    the database like this:

    Erik San Diego
    Erik San Francisco
    Erik Sacramento

    How can I find out what the selection value is if they picked more than one.

    Thanks.

    Big E


  • Steve Caliendo

    #2
    Re: Listbox database insert

    dim i as integer

    for i = 1 to listbox1.items. count
    if listbox1.items( i-1).selected = true then
    do stuff
    end if
    next


    "Big E" <nospam@nospam. com> wrote in message
    news:Ouqa50JVEH A.2320@TK2MSFTN GP10.phx.gbl...[color=blue]
    > I'm using ASP.Net and SQL Server 2000.
    > I have a Listbox that users can select multiple values. Selection Mode =
    > Multiple.
    > The multiple values are associated with one record. I need to insert into
    > the database like this:
    >
    > Erik San Diego
    > Erik San Francisco
    > Erik Sacramento
    >
    > How can I find out what the selection value is if they picked more than[/color]
    one.[color=blue]
    >
    > Thanks.
    >
    > Big E
    >
    >[/color]


    Comment

    • Big E

      #3
      Re: Listbox database insert

      How would I use this with a stored procedure that has parameters? Where
      would I stick this?

      Thanks.

      Big E
      MyCommand.Selec tCommand.Parame ters.Add(New SqlParameter("@ QuestionId",
      SqlDbType.Int))

      MyCommand.Selec tCommand.Parame ters("@Question Id").Value = txtQuestionId.T ext



      "Steve Caliendo" <scaliendo@epio n.com> wrote in message
      news:u7trHmKVEH A.2972@TK2MSFTN GP12.phx.gbl...[color=blue]
      > dim i as integer
      >
      > for i = 1 to listbox1.items. count
      > if listbox1.items( i-1).selected = true then
      > do stuff
      > end if
      > next
      >
      >
      > "Big E" <nospam@nospam. com> wrote in message
      > news:Ouqa50JVEH A.2320@TK2MSFTN GP10.phx.gbl...[color=green]
      > > I'm using ASP.Net and SQL Server 2000.
      > > I have a Listbox that users can select multiple values. Selection Mode =
      > > Multiple.
      > > The multiple values are associated with one record. I need to insert[/color][/color]
      into[color=blue][color=green]
      > > the database like this:
      > >
      > > Erik San Diego
      > > Erik San Francisco
      > > Erik Sacramento
      > >
      > > How can I find out what the selection value is if they picked more than[/color]
      > one.[color=green]
      > >
      > > Thanks.
      > >
      > > Big E
      > >
      > >[/color]
      >
      >[/color]


      Comment

      Working...