protected void PopulateListBox() { ListBoxUsers.Items.Clear(); //Clears any old items from the ListBox string sCommand = "SELECT * FROM Users order by LastName, " + "FirstName, UserName"; string sConn = "server=localhost;uid=sa;pwd=;database=TopSecret"; dataAdapter = new SqlDataAdapter(sCommand, sConn); commandBuilder = new SqlCommandBuilder(dataAdapter); ds = new DataSet(); dataAdapter.Fill(ds, "Users"); int iRowNumber = 0; DataTable dt = ds.Tables[0]; foreach (DataRow dr in dt.Rows) { ListItem listItem = new ListItem(); listItem.Value = "" + iRowNumber++; listItem.Text = dr["LastName"] + ", " + dr["FirstName"] + ": " + dr["Username"]; ListBoxUsers.Items.Add(listItem); } }