日期:2014-05-20  浏览次数:20723 次

ACCESS数据库的 城市级联 怎么在下拉的控件显示
省显示出来了 ,下面的是市,要怎么显示出来

C# code


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];
            }

        }




------解决方案--------------------
string sql = " select * from TB_Area where parentId=" + comsheng.SelectedItem.value;