Combox用ValueMember 之后再添加一项

在Combox插入“请选择”:

DataSetQueryFill(ds, "UNIT_REL_PARM", "select UNIT_CODE,ltrim(str(UNIT_CODE))+' '+UNIT_NAME as UNIT_NAME from UNIT_REL_PARM order by UNIT_CODE", null, true);
DataTable dt =ds.Tables["UNIT_REL_PARM"];

DataRow dr= dt.NewRow();
dr[0] = "0";
dr[1] = "请选择";
//插在第一位
dt.Rows.InsertAt(dr, 0);

comboBox.DataSource = dt;
comboBox.DisplayMember = "UNIT_NAME";
comboBox.ValueMember = "UNIT_CODE";

posted @ 2006-11-27 23:11  小y  阅读(1207)  评论(0编辑  收藏  举报