Combobox
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
string strCH ;
strCH = comboBox1.Text.ToString();
string strcmdTxt = "Select Name From Item_Code_Finishing Where Family = 'CH '";
//string strcmdTxt = "Select Item_code + Name From Item_Code_Finishing Where Family = 'CH '";
SqlDataAdapter mySqlAdapter = new SqlDataAdapter(strcmdTxt, ClsDataAcc.conString);
DataSet ds = new DataSet();
mySqlAdapter.Fill(ds, "Item_Code_Finishing");
comboBox2.DataSource = ds.Tables["Item_Code_Finishing"];
//comboBox2.DisplayMember = "Name";
comboBox2.DisplayMember = "Item_code";
}
我想要 comboBox2.DisplayMember = "Item_code + Name"; Item_code + Name相加的结果(//string strcmdTxt = "Select Item_code + Name From Item_Code_Finishing Where Family = 'CH '";
)用此语句,则出现 comboBox2. text = System.Data.DataRowView