row.Delete() doesn't delete the row, and still, prevents access to it.

G

Guest

Hi there , I'm experiencing problems accessing a row for which i called the my_row.Delete(), I need to access the row
as I can do if I call on my_table.rejectChanges().I need some data from that row
the general idea of the code is as brought in the code below, it fails on access to the row where the code is
- ((DataRow)enum_rows.Current

please send some code example if you can

changed_rows = tbl_deleted.Rows
IEnumerator enum_rows = changed_rows.GetEnumerator()
enum_rows.Reset()
while(enum_rows.MoveNext()

//on each row we try to get the parameters, if successfull
//we try writing to the the D
//((DataRow)enum_rows.Current
object[] arr_vals = ((DataRow)enum_rows.Current).ItemArray
for(int i = 0;i<arr_names.Length;i++

//ht- Hashtabl
ht[arr_names] = arr_vals
}//for loo

dostuff...
 
M

Miha Markic [MVP C#]

Hi Omri,

I would go with this:
foreach (DataRow row in table.Rows)

{

foreach (DataColumn col in row.Table.Columns)

Console.WriteLine(row[col, DataRowVersion.Original]);

}


--
Miha Markic [MVP C#] - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

Omri Rotem said:
Hi there , I'm experiencing problems accessing a row for which i called
the my_row.Delete(), I need to access the row,
as I can do if I call on my_table.rejectChanges().I need some data from that row.
the general idea of the code is as brought in the code below, it fails on
access to the row where the code is
- ((DataRow)enum_rows.Current.

please send some code example if you can.


changed_rows = tbl_deleted.Rows;
IEnumerator enum_rows = changed_rows.GetEnumerator();
enum_rows.Reset();
while(enum_rows.MoveNext())
{
//on each row we try to get the parameters, if successfull-
//we try writing to the the DB
//((DataRow)enum_rows.Current)
object[] arr_vals = ((DataRow)enum_rows.Current).ItemArray;
for(int i = 0;i<arr_names.Length;i++)
{
//ht- Hashtable
ht[arr_names] = arr_vals;
}//for loop

dostuff...
 
Top