Difference between rows.add and importRow

前端 未结 2 1820
故里飘歌
故里飘歌 2021-01-17 20:50

When adding a row to a datatable in vb.net, what is the difference between rows.add and importRow?

Dim dt As DataTable
Dim dr As DataRow

\'Add row this way.         


        
2条回答
  •  时光说笑
    2021-01-17 21:10

    The suggested answer is incorrect. The MSDN article below shows that dt2.ImportRow(dr1) will NOT import dr1. This is because it is in a detached state. Also dt2 has not schema.

    http://msdn.microsoft.com/en-us/library/system.data.datatable.importrow.aspx

提交回复
热议问题