Status Changed }; foreach (var item in unfinishedorder. dt Status Changed { get; set; } public cls Main Data (int NO, string Order Number, string Type Number, int Color, int Width, int Height, string Status, Date Time? = null) { string ordernumber = (row Value as cls Main Data)Order Number; var update = from x in con. Order Number == ordernumber select x; foreach (var item in update) { item. I updated my question to include more information to the thoughts behind the process.

You can sort the rows with the column Color for example to run through rows with a certain color code first.

The highlighted row is then moved to the next one etc.

private void update Database Status(string status) { var row Value = dxg Main Grid.

I am wondering what the best practice for updating a list that only accepts unique items. status Changed) { No = no; Order Number = order Number; Type Number = type Number; Color = color; Width = width; Height = height; Status = status; Status Changed = status Changed; } } If this is not the case, ignore this tip. Naming tips will already be applied without further explanation, this is done in the previous part.

Right now, I have a button that loads data from a database into a list. Since you already know the loaded data in the method, you should not get the items from the database and then check which ones you want to add to the main data list. Order Number == order Number); foreach (var order in orders To Update) { order.

I can press this button numerous times to check if there is any new data in it. Fetch only the items that are not already in the list.

Here is the method I created: private void load New Data From Database() { Data Classes1Data Context con = new Data Classes1Data Context(LOCALDB_CONN_STRING); var unfinishedorder = from x in con. This makes more sense but more important: your SQL-task will be less heavy. = null) { var db Context = new Data Classes1Data Context(LOCALDB_CONN_STRING); var order Number = (row Value as Main Data).

Status Changed { get; set; } public Main Data (int no, string order Number, string type Number, int color, int width, int height, string status, Date Time?

public class Main Data { public int No { get; set; } public string Order Number { get; set; } public string Type Number { get; set; } public int Color { get; set; } public int Width { get; set; } public int Height { get; set; } public string Status { get; set; } public Date Time?