You will get this exception, when you are trying to access the deleted row from a
Typed Dataset
Quote:
What do I need to do to get DeletedRowInaccessibleException?
Right Click the project -> Add -> New Item -> Data -> DataSet -> Name it as
DataSet1.xsd
in the designer window -> right click -> add -> DataTable -> Name it as
DataTable1
-> right click the header of the table and -> add -> 2 Columns ( name it as
Column1
and
Column2
) ->
Save
now execute this code
static void Main(string[] args)
{
try
{
DataSet1 ds = new DataSet1();
ds.DataTable1.AddDataTable1Row("1", "One");
ds.DataTable1.AddDataTable1Row("2", "Two");
ds.AcceptChanges();
ds.DataTable1.Rows[0].Delete();
foreach (DataSet1.DataTable1Row row in ds.DataTable1.Rows)
{
string temp = row.Column1;
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}