in your dataset, the table adapters that load values used in combo boxes (lookup values) should probably be a SELECT * with no where clause. Tables that you're going to add new records to forever should be based on a SELECT * WHERE ...
I typically advocate that the main query in a table adapter be `WHERE id = @id` and then the other/additional queries on it be more useful , such as searching multiple records by some other columns. Name all queries properly, using ByXxx as a name suffix when you have a query with a where clause. Don't end up with a dataset whose tabkeadapter methods are named like "Fill", "FillBy", "FillBy1", "FillBy2"
-
When you work with related lookup data, such as having a Person table with a GenderId column, and separately a Gender table with an Id column, and GenderDesc columns (the latter being a descriptive text like Male, Female, Jedi, Other), and you want to show the person records in a DataGridView but have the gender column in the grid be full of drop downs then you-
* drag a Person grid onto the form from the data sources window
* drag a Gender grid to the form but delete it again; we will use the other things doing so generates but not the grid
* edit the colunns
* change the Gender column to be a datagridviewcomboboxcolumn type
* set the DataSource of the combo to be the gender bindingsource
* set the DisplayMember of the column to be the GenderDesc column
* set the ValueMember of the column to be the Id column (of the gender table)
* set the DataPropertyName of the column to be the GenderId column (it's of the person table)
* ensure the code has a Fill that fills all genders into the dataset gender table upon form load. You should never clear the dataset or these genders will be lost
Now your grid is set up to load person records and when it finds eg Id 1 in the person table, to be able to look that up as Id 1 in the genders table and show the associated description (eg Female). The combo not only looks up 1 to a string Female when showing the record, but it also performs the reverse action of setting Person.GenderId to 2 if the user chooses Male from the dropdown
There isn't a limit to how many you can have in this way, just have a table in your dataset per lookup factor you want (MaritalStatus, EmploymentStatus etc etc) and fill them with records that you leave alone
In case it wasn't made clear already, you should not load every hundreds of thousands of people into your dataset when the form loads. If you ensure your SELECT * FROM Person WHERE ... query on your person table adapter does actually have a WHERE clause then this won't happen. Provide a search to the user where they can look up eg last name being smith, at the push of a button. Load the lookup values automatically- there aren't many of them, and then wait for the user to load 100 people all called smith
If you want to show related data (eg click the person on the main grid and see a list of all the addresses they ever lived at) in another grid that is a separate process, not like the above