绑定下拉框

DataTable dt = new DataTable();
string sql = string.Format(@"SELECT [xingming],[nianji] ,[xuehao] FROM [dbo][123]");
SqlDataAdapter ds = new SqlDataAdapter(sql, DBHelpercs.StrConn);
ds.Fill(dt);
this.cobnianji.ValueMember = "xingming";
this.cobnianji.DisplayMember = "xuehao";
this.cobnianji.DataSource = dt;

posted @ 2017-10-28 21:07  王钰鑫  阅读(133)  评论(0编辑  收藏  举报