I have next data in my xml file:


I need to insert one more "node". I have next code:

DataRow d_f = ds.Tables[ "node" ].NewRow();
d_f[ "first" ] = strInt;
ds.Tables[ "node" ].Rows.InsertAt( d_f, 0 );

DataRow d_s = ds.Tables[ "second" ].NewRow();
d_s[ "myInt0" ] = str_0;
d_s[ "myInt1" ] = str_1;
d_s[ "myInt2" ] = str_2;
ds.Tables[ "second" ].Rows.InsertAt( d_s, 0 );

DataRow d_t = ds.Tables[ "node" ].NewRow();
d_t[ "third" ] = str_T;
ds.Tables[ "node" ].Rows.InsertAt( d_t, 0 );

ds is a DataSet, str_* all of them are string variable not null. I am using a schema, so the order of "first", "second" and "third" is very important for me.

The code does not insert the "node" correctly. :( What should I do in order to correct the problem How to work with such XML files

Thank you!

Re: XML and the .NET Framework how to insert a DataRow into a DataSet?


OK, I solved the problem... ;)

The solution is to use something like that:


Thanks anyway! :)