Thursday, 22 August 2013

populated values in combobox do not update even on refreshing the combobox

populated values in combobox do not update even on refreshing the combobox

My problem is : I have a combobox,which i am populating using the
following code.It populates perfectly but i want it to refresh and fetch
only the values which have deliverystatus ='pending' in the database(the
combobox is populated for only those details which have a field named
delivery status set to 'pending'),after i click the send button,the
database is updated with deliverystatus=approved but the combobox still
shows the value i just updated i.e. with deliverystatus =approved(after
send clicked).But i want the value with delivery status =approved' to be
removed frm the combobox automatically after i send the details.
using (SqlConnection se = new SqlConnection("Data Source=HP-HP;Initial
Catalog=MIND;Integrated Security=True"))
{
try
{
SqlDataAdapter d = new SqlDataAdapter("select UniqueID from
deliverydata where delivery_status='Pending' and approvedby=(select
name from TEAM where emailid='" + attach.newvalue() + "')", se);
DataSet dt = new DataSet();
d.Fill(dt);
comboBox_deliverytypedisp.DataSource = dt.Tables[0]; /// assing the
first table of dataset
comboBox_deliverytypedisp.DisplayMember = "UniqueID";
}
catch (Exception ex)
{
// write exception info to log or anything else
MessageBox.Show(ex.ToString());
}
}

No comments:

Post a Comment