winform combox绑定问题
在load事件里给两个combox绑定值,代码如下:
//combox1绑定值
ocnn = new OleDbConnection(connections);
ocnn.Open();
ocmd = ocnn.CreateCommand();
ocmd.CommandText = "select distinct Single_Date from MIS_InsertSingle";
DataSet ds = new DataSet();
oda = new OleDbDataAdapter(ocmd);
oda.Fill(ds);
this.cbo_Date.DataSource=ds.Tables[0];
ocnn.Close();
//combox2绑定值
OleDbConnection cnn = new OleDbConnection(connections);
cnn.Open();
OleDbCommand cmd = cnn.CreateCommand();
cmd.CommandText = "select Out_Date from MIS_OutSingle";
DataSet set = new DataSet();
OleDbDataAdapter da = new OleDbDataAdapter(cmd);
da.Fill(set);
this.cbo_OutDate.DataSource=set.Tables[0];
cnn.Close();
combox1显示正常而combox2的下拉列表值全是 System.Data.DataRowView。请问这是为什么。
[解决办法]