我的问题是:我有一个组合框,我正在使用以下代码填充它。它完美填充,但我希望它刷新并仅获取具有
deliverystatus ='pending'
在数据库中(组合框仅填充那些将交付状态设置为“待定”的字段的详细信息),单击发送按钮后,数据库将更新为
deliverystatus=approved
但组合框仍然显示我刚刚更新的值,即
deliverystatus =approved
(点击发送后)。但我希望在发送详细信息后自动从组合框中删除传递状态 = 已批准的值。
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());
}
}