Select and updating data from datatable
c#, datatable, recordset, select
Solution
This is one way to update datatable data....
DataRow[] HRow = dataSet1.Tables["Human"].Select("Size >= 230 AND Sex = 'm'");
HRow[0]["Size"] = 230;
HRow[0]["Sex"] = "m";
Problem
I select data from my datatable, by using following code: ``` DataRow[] result = table.Select("Size >= 230 AND Sex = 'm'"); ``` Now I change the data in the datarow-array result and I want to update my datatable (datatable should get the changes). Which is the easiest way to do that? In VB6 I could simply set a filter, on the recordset, edit my rows and simply save my changes. Is there a similar way using DataTables? EDIT: I have an additional question. What, if I wanna add a new row and I want to reuse the same code? For example like that: ``` filteredRows = myDataset.Tables[0].Select("select where id = 1"); if (filteredRow.Lenght == 0) { filteredRows = myDataset.Tables[0].NewRow(); } // I wanna use this code, no matter if I edit a row, or if it is a new row. filteredRows[index]["Name"] = "Max"; filteredRows[index]["Address"] = "Random Address"; filteredRows[index]["WhatEver"] = "..."; //... ``` I tried this way, but it doesn't affect the original dataset.