I have two tables in database, Notes and Categories (with Notes having a foreign key to Categories).
I have loaded data from table Notes and in combobox from table category.
Now I need to select the same category(foreign key) as in note in the combobox.
My code is :
DataTable dtCat = qc.getCategory();
cmbCategory.DataSource = dtCat;
cmbCategory.DisplayMember = "categoryName";
cmbCategory.ValueMember = "categoryId";
cmbCategory.SelectedValue = "categoryId";