combobox数据绑定


        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();
        }

你可能感兴趣的:(combobox)