方法一:
//取得所有部门信息
dsdept = myFind.GetDept(out ErrMsg);
//插入空行
cmbDept.ValueMember.Insert(0,"");
cmbDept.DisplayMember.Insert(0,"");
//读取其他hang
for (int i=1;i<=dsdept.Tables[0].Rows.Count;i++)
{
cmbDept.ValueMember.Insert(i,dsdept.Tables[0].Rows[i]["DEPTCODE"].ToString().Trim());
cmbDept.DisplayMember.Insert(i,dsdept.Tables[0].Rows[i]["DEPTNAME"].ToString().Trim());
}
方法二:
dsdept = myFind.GetDept(out ErrMsg);
cmbDept.DataSource = dsdept.Tables[0];
cmbDept.DisplayMember = "DEPTNAME";
cmbDept.ValueMember = "DEPTCODE";
//插入空行
cmbDept.SelectedItem = null;
cmbDept.SelectedValue = "";
cmbDept.Text = "";