您的位置:首页 > 其它

combobox数据绑定

2008-11-29 22:22 176 查看
Code

        public void fill_combobox_reader(string sql,ComboBox combo,string tablename,string read_value)

        {                

            co.co();

            SqlDataAdapter adapter = new SqlDataAdapter(sql, co.conn);

            DataSet ds = new DataSet();

            adapter.Fill(ds,tablename);

            combo.DataSource = ds.Tables[tablename];

            combo.DisplayMember = read_value;

            combo.ValueMember = read_value;

            co.dis_co();

        }
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: