comboBox加载数据重复了怎么办
我做了一个comboBox联动,现在通过第一个comboBox中的选项,第二个comboBox可以显示相对应的数据,可是再通过第一个comboBox选择的时候,第二个comboBox中的数据是上一次的加上这一次的,怎么可以去掉上一次的数据,每次都显示当前这回选择的?还有我想在加载的时候出现==请选择==,可是也没显示?
private void dataExcel_Load(object sender, EventArgs e)
{
db.RunSQL("select goodsoffer from goodsInfo group by goodsoffer", ref ds, "goodsInfo");
DataTable dtGroup = ds.Tables["goodsInfo"];
comboBox1.DataSource = dtGroup;
comboBox1.DisplayMember = "goodsOffer";
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
if (comboBox1.SelectedIndex > -1)
{
DataRowView drv = (DataRowView)comboBox1.SelectedItem;
string gId = drv.Row["goodsOffer"].ToString();
db.RunSQL("select goodsID,goodsBrand from goodsInfo where goodsoffer='" + gId + "'", ref ds, "goodsInfo1");
DataTable dtUser = ds.Tables["goodsInfo1"];
comboBox2.DataSource = dtUser;
comboBox2.DisplayMember = "goodsBrand";
}
}