ACCESS数据库的 城市级联 怎么在下拉的控件显示

「已注销」 2011-09-14 10:08:22
省显示出来了 ,下面的是市,要怎么显示出来



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

}

...全文
74 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
「已注销」 2011-09-14
  • 打赏
  • 举报
回复
弄好了,谢谢大神指教.....
「已注销」 2011-09-14
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 net_lover 的回复:]
string sql = " select * from TB_Area where parentId=" + comsheng.SelectedItem.value;
[/Quote]

这样写 后面的VALUE 用不了 新手求教
孟子E章 2011-09-14
  • 打赏
  • 举报
回复
string sql = " select * from TB_Area where parentId=" + comsheng.SelectedItem.value;

17,740

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 .NET Framework
社区管理员
  • .NET Framework社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧