datatable query-urgent

  • Thread starter Thread starter reiks
  • Start date Start date
R

reiks

I'm a newbie to ado.net. my requirement is as follows

I have a datatable with me and I have to write a function
which takes in a row number and column name and finds
whether in the given row no, the column value has been
modified or not.

For eg my original table is
au_lname au_fname

vijaya laxmi
nitin pillai
reiks reku
sai babu

Now if modify 'vijaya' as 'viju',
then I should be able to find that column au_lname with
value as 'vijaya' has been modified in row 1

my input to the function would be
rowno-1,
column name-au_lname.

I have used 'rowstate' property. But it's giving the
output as 'modified' irrespective of the column modified
i.e. even if I give i\p as (1,au_lname) and au_fname has
been modified instead of au_lname, it's giving me the
result as 'modified'

can anyone plzz help me out

thanks in advance,
reiks
 
Hi reiks,

You should compare the values by yourself.
Check out DataRow.Item property, in particular the version that takes
DataRowVersion parameter.
You should do something like:
bool noChanges = currRow[myColumn,
DataRowVersion.Current].Equals(currRow[myColumn, DataRowVersion.Original]);

And beware, that if you don't call AcceptChanges() there won't be an
Original value.
RowState indicates the state of the entire row.
 
Back
Top