コンボボックスにストアドプロシージャの名前を設定しようとしています。コンボボックスをストアドプロシージャ内のデータで埋めてください。
public frmAddEdit(Book book, Author author)
{
_book = book;
_author = author;
_dataAccess = DataAccess.GetInstance;
_dataAccess.SetConnectionString(_dataAccess.GetServerConnectionString());
ComboFill();
InitializeComponent();
}
これは私がオンラインを見て、それを試してみました私のコンボボックス
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
DataRowView view = comboBox1.SelectedItem as DataRowView;
string fullName = view["FullName"].ToString();
}
何か私の負荷フォーム
public void AddEditBook_Load(object sender, EventArgs e)
{
txtTitle.Text = _book.Title;
//comboBox1.DataSource = _book.FullName;
//comboBox1.ValueMember = "AuthorId";
//comboBox1.DisplayMember = "FullName";
ComboFill();
//txtAuthor.Text = _author.FullName;
//txtAdd.Text = book.Title;
}
です。
public void ComboFill()
{
DataRow dr;
DataTable dt = new DataTable();
dr = dt.NewRow();
// dr.ItemArray = new object[] { 0, "Select Author" };
dt.Rows.InsertAt(dr, 0);
comboBox1.DataSource = _book.FullName;
comboBox1.ValueMember = "AuthorId";
comboBox1.DisplayMember = "FullName";
}
なぜあなたは簡単な方法でそれを行うことができたときに、複雑なのですか? –
'System.Windows.Forms.ComboBox'とタイプし、' ValueMember'または 'DisplayMember'という名前のプロパティはありません。 –
あなたの質問は何ですか?何かエラーがありますか?どうしたの? – Pikoh