日期:2014-05-18 浏览次数:20798 次
string sql="Select * from 系别表"; DataTable Deptdt = DBHelper.GetTable(sql); combobox1.DataSource = Deptdt; combobox1.DisplayMember = "系别号"; combobox1.ValueMember = "系别名称"; private void cboDept_SelectedIndexChanged(object sender, EventArgs e) { string sql="select * from 班级表 a,系别表 b where a.系别号=b.系别号 and a.系别号 =combobox1.selectedValue"; DataTable ClassDt= DBHelper.GetTable(sql); combobox2.DataSource = ClassDt; combobox2.DisplayMember = "班级号"; combobox2.ValueMember = "班级名"; }
------解决方案--------------------
5楼的DBHelper是另为定义的类,你把他看作得到了这张系表表