現在私が持っているデータセットからコンボボックスを作成するために次に何をすべきかについて、レンガの壁にぶつかりました。私のデータベースは「PID2db.mdb」と呼ばれ、テーブルは「Customer」と呼ばれます
string strCon = Properties.Settings.Default.PID2dbConnectionString;
OleDbConnection conn = new OleDbConnection(strCon);
try {
conn.Open();
string strSql = "Select forename,surname from customer where [customerID] ='" + txtName.Text + "'";
OleDbDataAdapter adapter = new OleDbDataAdapter(new OleDbCommand(strSql, conn));
DataSet ds = new DataSet();
adapter.Fill(ds);
cboName.DataSource = ds.Tables[0];
cboName.DisplayMember = "forename";
cboName.ValueMember = "surname";
}
finally {
conn.Close();
}
}
どんな助けでも大歓迎です、ありがとう
編集:新しいコードセグメントを追加