public void fillUserType()
{
helper.openServer();
DataTable table_type = new DataTable();
string sql = "select * from user_type;";
helper.GetMySqlDataTable(sql, ref table_type);
userType.DataSource = table_type;
userType.DisplayMember = "type_name";
userType.ValueMember = "type_no";
}
private void userType_SelectedIndexChanged(object sender, EventArgs e)
{
if (userType.SelectedIndex > -1)
{
DataTable table_name = new DataTable();
string type_id = userType.ValueMember;
string sql = "select user_Type.type_table from user_type where user_type.type_no = " + type_id;
//type_id 的值一直是type_no!!!!!!!!
//各路大神为什么呀!!!!!!!!!
helper.SetUserTypeTable(sql);
}
else
{
return;
}
}
string type_id = userType.ValueMember;
这一句改成
string type_id = userType.SelectValue;