I have a dataset that is constructed from various sources. So, the number of fields in them varies from one places to another. However, it is all for the same table. The goal is to find the missing fields and add them into the dataset.
The first part is to detect the missing field. This is no problem. I have a collection of all the required fields. I compare with what I have in the dataset. If it is not in there, I add them up in a variable such as "Table.FirstName,Table.LastName,etc.". Some sources may have 1 record, others 136 and so on. So, I need to execute a SQL command which will go get the missing field values from the table so the result would be the final version of the dataset.
Once step I have to go through is to get all the primary keys. So, lets say I have them up in a collection, in a list such as "12, 1024, 3244, 1211" or else. I then need to execute a SQL command to get the missing fields based on those primary keys. I am pretty sure there is a better way to achieve that then to construct a SQL command with a bunch of WHERE clauses with an OR statement for each of the primary key. Anyone would have an idea on a better route to take?