datatable sort get first row

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I basically have a datatable with multiple rows in it. I basically want to
sort the datatable (based on a expression) then refer to the first row that
comes up in the sort and change a value in it. I'm currently using the vs
2005 beta. (c# windows form). Can anyone suggest how to do this?
 
I forgot to mention that the datatable is not based on any sql table. I
created a disconnected xml dataset that's populated in the program.
 
gl said:
I basically have a datatable with multiple rows in it. I basically want to
sort the datatable (based on a expression) then refer to the first row
that
comes up in the sort and change a value in it. I'm currently using the vs
2005 beta. (c# windows form). Can anyone suggest how to do this?

Try something like this (I say "something" because I haven't actually
compiled and/or tested it <g>):

DataTable custTable = custDS.Tables["Customers"];
DataView custView = custTable.DefaultView;
custView.Sort = "CompanyName";

custView[1]["name"] = "Michael";

....


HTH,

Mike Rodriguez
 
Back
Top