0
Reply

combobox populate and edit

heidi

heidi

Nov 8 2005 5:14 PM
1.6k

Hi everyone,

I'm new at this so forgive me for any dumb questions.  Here goes:

I am trying to bind a combobox with existing data.  I am able to display the data however the other options do not show up in the combobox. 

The combobox has options: Yes, No, UNK.

When I bind it, it takes the value stored in the database(for example Yes), but the other values(no, UNK) are no longer available.  I want the other values to be visible and yes show the current data for that particular field.  I am using a stored procedure to combine the look up table and the table. 

--The name of the stored procedure is usp_Eli
--stored procedure has 1 parameter
--The name of the data table is tblEligibleCriteria

The connection works fine..The data is displayed.  Well here is the code, please help, I've been pulling my hair out for this.  thanks.   Heidi.

SqlCommand cmdEli = new SqlCommand("dbo.usp_Eli", CohortConn);
cmdEli.CommandType = CommandType.StoredProcedure;
cmdEli.Parameters.Add("@MSI",SqlDbType.Int, 4);
cmdEli.Parameters["@MSI"].Value = txtMSI.Text;
SqlDataAdapter daEli =
new SqlDataAdapter(cmdEli);
DataSet dsEli =
new DataSet();
daEli.Fill(dsEli, "tblEligibleCriteria");

cmboLveHere.DataSource = dsEli.Tables["tblEligibleCriteria"];
cmboLveHere.DisplayMember = "LveHere";