interviews.dotnetthread.com

↑ Grab this Headline Animator

Friday, July 11, 2008

How to add a new row into DataSet / DataTable at a desired position.

DataRow newRow = ds.Tables[0].NewRow();
newRow[0] = "valueofcolumn1";
newRow[2] = "valueofcolumn2";

ds.Tables[0].Rows.InsertAt(newRow,);

EX: to add a row into DataSet at the top (at 0 position)
ds.Tables[0].Rows.InsertAt(newRow,0);

Submit this story to DotNetKicks

No comments:

Post a Comment

Post your comments/questions/feedback for this Article.

 

Latest Articles