且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将新行添加到数据表的顶部

更新时间:2021-08-24 07:03:56

您使用NewRow创建具有相同列的行。要真正将其放入数据表,必须要做的

You use the NewRow to create a row with the same columns. To actually get it into the DataTable, you've got to do

myDataTable.Rows.InsertAt(myDataRow, 0);

其中0是要插入索引的位置。

Where 0 is the index you want to insert it at.