string select = "select ClassID from dbo.GoodsClass";
SqlDataReader dr = db.ExecuteReader(select);
WHILE(dr.Read())
{
comboBox1.Items.Add(dr["ClassID"]);
}
把if 换成 while 就可以了。
如果你的GoodsClass表中有多行数据,是可以逐个写入到combobox的,怀疑只有一条数据。