Elisabeth
Elisabeth

Reputation: 21226

DataRow which is added is not going to be delete doing table.Rows[i].Delete()?

Why is that? The state of the datarow is added. When I delete the row the state is unchanged. Why not deleted? That's the reason my Delete Store Procedure is never called!

edit: the datarow is freshly added and then I try to delete it.

Upvotes: 0

Views: 158

Answers (1)

Andrey
Andrey

Reputation: 60085

show your code please. my test shows that everything works fine:

        DataTable dt = new DataTable();
        DataRow dr = dt.NewRow();
        dt.Rows.Add(dr);
        Console.WriteLine(dr.RowState);
        dr.Delete();
        Console.WriteLine(dr.RowState);

output is:

        Added
        Detached

Upvotes: 0

Related Questions