开发者

.Net - ado.net importing rows vs adding rows?

The DataTable has a method called ImportRow(), There is also 开发者_Go百科a method unders the rows called Add(). So what's the difference between these methods?

dataTable.Rows.Add(newRow);

vs

dataTable.ImportRow(newRow);


  • ImportRow preserves any setting of the row: DataRowState,values etc.
  • Add calls NewRow that initialize a row using default values.

ImportRow is useful if you're importing a row from another table and you need to preserve all because you're planning to use a DataAdapter

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜