本文介绍了在C#查询SQL语句中的Even SelectedValueChange Combobox1中设置DataSoure Combobox2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 帮助我! private void LoadCity() { DataTable tb = new DataTable( ); tb = bct.UpdateTB(选择*来自TB_City); cbbCity.DataSource = tb; cbbCity.DisplayMember = CityName; cbbCity.ValueMember =CityCode; } private void LoadDistrict() { DataTable tb = new DataTable(); tb = bdt.UpdateTB(选择*来自TB_District,其中CityCode =+ int .pare(cbbCity.SelectedValue.ToString())+); cbbDistrict.DataSource = tb; cbbDistrict.DisplayMember =DistrictName; cbbDistrict.ValueMember =DistrictCode; } private void frmSinhVien_Load(object sender,EventArgs e) { nudPointIn.Deci malPlaces = 1; nudPointIn.Increment = 0.5M; dgvView.DataSource = bst.UpdateTB(); LoadCity(); LoadDistrict(); } private void cbbCity_SelectedValueChanged(对象发送者) ,EventArgs e) { LoadDistrict(); } 运行项目错误:输入字符串的格式不正确: tb = bdt.UpdateTB(选择*来自TB_District,其中CityCode =+ int.pare(cbbCity.SelectedValue.ToString()) +); 我的英文不好:((我是国际越南人解决方案 Help me!private void LoadCity() { DataTable tb = new DataTable(); tb = bct.UpdateTB("Select * From TB_City"); cbbCity.DataSource = tb; cbbCity.DisplayMember = "CityName"; cbbCity.ValueMember = "CityCode"; } private void LoadDistrict() { DataTable tb = new DataTable(); tb = bdt.UpdateTB("Select * From TB_District Where CityCode=" + int.pare(cbbCity.SelectedValue.ToString()) + ""); cbbDistrict.DataSource = tb; cbbDistrict.DisplayMember = "DistrictName"; cbbDistrict.ValueMember = "DistrictCode"; } private void frmSinhVien_Load(object sender, EventArgs e) { nudPointIn.DecimalPlaces = 1; nudPointIn.Increment = 0.5M; dgvView.DataSource = bst.UpdateTB(); LoadCity(); LoadDistrict(); } private void cbbCity_SelectedValueChanged(object sender, EventArgs e) { LoadDistrict(); }Run Project error: Input string was not in a correct format form:tb = bdt.UpdateTB("Select * From TB_District Where CityCode=" + int.pare(cbbCity.SelectedValue.ToString()) + "");I'm bad English :(( I'm International Vietnamese 解决方案 这篇关于在C#查询SQL语句中的Even SelectedValueChange Combobox1中设置DataSoure Combobox2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 09-15 19:55