17,740
社区成员
发帖
与我相关
我的任务
分享
public void bindCityName()
{
string sql = "select * from TB_Area where parentId=0";
DataSet ds = DBHelp.GetDataSet(sql);
comsheng.DisplayMember = "Name";
comsheng.ValueMember = "Id";
comsheng.DropDownStyle = ComboBoxStyle.DropDownList;
comsheng.DataSource = ds.Tables[0];
}
private void comsheng_SelectedIndexChanged(object sender, EventArgs e)
{
if (comsheng.SelectedItem != null)
{
comshi.Enabled = true;
string sql = " select*from TB_Area where parentId=comsheng.SelectedItem.value";
DataSet ds=DBHelp.GetDataSet(sql);
comshi.DisplayMember = "Name";
comshi.ValueMember = "Id";
comshi.DropDownStyle = ComboBoxStyle.DropDownList;
comshi.DataSource=ds.Tables[0];
}
}