I can populate the drop down list no problem. What I want to do is save the selected data into another table which is related via foreign key. So I want the list to show the text description(Name) but when it is selected I want the EventID to be saved.
ThanksCode:SqlConnection conn = new SqlConnection(@" server = .\sqlexpress; integrated security = true; database = HoopDataSample"); string qryEvents = @"select EventID,Name from Events order by Name"; try { conn.Open(); //****Get Event Info to Fill Event Combo Box SqlCommand cmd = new SqlCommand(qryEvents, conn); SqlDataReader rdr = cmd.ExecuteReader(); while (rdr.Read()) { comboBoxEvents.Items.Add(rdr[1]); //rdr[0] is the EventID,rdr[1] is the Name } rdr.Close(); }


Reply With Quote

Bookmarks