R
Rastko Soskic
Hi everyone!
As stated in subject I have problem with accessing deleted rows within
dataset,
that is, deleted rows within table contained in dataset.
Dataset is strongly typed (generated by designer).
I need to say that I've done this by following tips in MSDN.
First I create dataset, then entity I want to add.
public void Sample()
{
TypedDataSet ds = new TypedDataSet();
ds.Tables["TableName"].Rows.Add(entity.CreationParams); //
CreationParams is property
// which returns object[] with required values
// Adding row works perfectly!
// Then, I find and delete row
DataRow dr = ds.Tables["TableName"].Rows.Find(entity.Identity) //
Identity is property
dr.Delete();
// which returns object[] with PK values
// Removing row also works perfectly!
// Now, I should be able to get those rows with "Deleted" status this
way:
DataView dv = new DataView(ds.Tables.["TableName"], "", "",
DataViewRowState.Deleted);
// But!!! dv, that is dv.Table.Rows is EMPTY!!!
// Alternatively, I've tried with ds.Tables["TableName"].Select(null,
null, DataViewRowState.Deleted);
// but no luck there
}
My question is simple What I am doing wrong?
Any advice, tip, suggestion, help is appreciated. Thank you very much
As stated in subject I have problem with accessing deleted rows within
dataset,
that is, deleted rows within table contained in dataset.
Dataset is strongly typed (generated by designer).
I need to say that I've done this by following tips in MSDN.
First I create dataset, then entity I want to add.
public void Sample()
{
TypedDataSet ds = new TypedDataSet();
ds.Tables["TableName"].Rows.Add(entity.CreationParams); //
CreationParams is property
// which returns object[] with required values
// Adding row works perfectly!
// Then, I find and delete row
DataRow dr = ds.Tables["TableName"].Rows.Find(entity.Identity) //
Identity is property
dr.Delete();
// which returns object[] with PK values
// Removing row also works perfectly!
// Now, I should be able to get those rows with "Deleted" status this
way:
DataView dv = new DataView(ds.Tables.["TableName"], "", "",
DataViewRowState.Deleted);
// But!!! dv, that is dv.Table.Rows is EMPTY!!!
// Alternatively, I've tried with ds.Tables["TableName"].Select(null,
null, DataViewRowState.Deleted);
// but no luck there
}
My question is simple What I am doing wrong?
Any advice, tip, suggestion, help is appreciated. Thank you very much