"person"という表の名前と姓をコンボボックス1に連結したいとします。 すべての解決をしてください! ... しかし、そうではありません。( "PERSONNEからPRENOM_PERSONNE)、「「、(NOM_PERSONNEを連結を選択」、CN")> ダ=新しいSqlDataAdapterオブジェクト -コンボボックスのデータテーブルから2列を表示
public MyForm()
{
InitializeComponent();
combobox1_load();
}
public void combobox1_load()
{
da = new SqlDataAdapter("select * from PERSONNE ", cn);
dt = new DataTable();
try
{
cn.Open();
da.Fill(dt);
comboBox1.DataSource = dt;
comboBox1.DisplayMember = "NOM_PERSONNE , PRENOM_PERSONNE";
// comboBox1.ValueMember = "ID_PERSONNE";
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
cn.Close();
}
}
は、私はそのようなSqlDataAdapterオブジェクトを変更しようとしましたあまりにWORKING !!
一緒にフィールドを連結するというあなたの方法は正しいものですが、結果として連結に名前を与え、私が試したDisplayMemberプロパティ – Steve