Andre,
Unless I'm missing something, you code should work fine. I update the
DataRow array returned from a DataTable.Select() call all the time, and
the changes flow through to the original DataTable/DataSet.
The rows returned from Select aren't copies - they're the actual rows in
the original table.
As for strongly-typed DataSets and DataRow arrays: Believe it or not,
you can just cast the result from Select, like this:
MyDataSet.MyTableRow[] rows;
rows = (MyDataSet.MyTableRow[])ds.MyTable.Select(...);
I was pleasantly surprised when I discovered that!
Cheers,
Matt
Andre Ranieri wrote:
> After querying a data table into a DataRow array using DataTable.Select()
> method, is there any way of updating the table with changes made to the
> DataRow array?
>
> In this example, rows in the original data table do not change even when I
> change column values in the datarow array itself.
>
> Also, the following code creates an untyped data row array. Is it possible
> to create a datarow array that's strongly typed based on the strongly typed
> datatable it's selected from?
>
> Thanks in advance,
>
> Andre Ranieri
>
>
> DataRow[] r = Class1.myDS.Categories.Select("", "CatOrder");
> for (int i =0; i < r.Length; i++)
> {
> lvCategories.Items.Add(r[i]["Category"].ToString().Trim());
> r[i]["CatOrder"] = iCounter;
> iCounter++;
> }
> Class1.myDS.AcceptChanges();