Bug in ListBoxControl ???
Posted on 2004-09-10
I have a webform that uses a listboxcontrol to display a list of users from a table. Once the form is submitted I would like to have the values passed to the database. The problem is that only the first int value of the selected users is passing through to the database.
Can someone evaluate my code and pin point the problem for me.
<asp:listbox id="Creator" runat="server" SelectionMode="Multiple" Rows="1"></asp:listbox>
Conn = new SqlConnection("server=C099450d01;uid=sa;pwd=;database=tools");
Cmd = new SqlCommand("SELECT ID, LastName + ', ' + FirstName AS Name FROM Employee ORDER BY LastName", Conn);
Creator.DataSource = Cmd.ExecuteReader();
Creator.DataTextField = "Name";
Creator.DataValueField = "ID";
cmd.Parameters.Add(new SqlParameter("@Creator", Creator.SelectedItem.Value));
I can't seem to get all of the values of those selected.