如何一次复制DataRow(整行)的所有值?

Dim curRow As DataRow = PTable.Rows.Item(DataGrid1.CurrentCell.RowNumber)
Dim tarRow As DataRow = PTable.Rows.Item(DataGrid1.CurrentCell.RowNumber+1)
Dim cacRow As DataRow = PTable.NewRow
cacRow(0) = curRow(0) '暂存行
cacRow(1) = curRow(1)
cacRow(2) = curRow(2)
'cacRow=curRow '我想这样存行,可就是不行,比较郁闷
'change
curRow(0) = tarRow(0)
curRow(1) = tarRow(1)
curRow(2) = tarRow(2)
'curRow=tarRow
tarRow(0) = cacRow(0)
tarRow(1) = cacRow(1)
tarRow(2) = cacRow(2)
tarRow=cacRow
---------------------------------------------------------------

'cacRow=curRow 这样不对,应该这样:
cacRow.ItemArray = curRow.ItemArray

Published At
Categories with Web编程
Tagged with
comments powered by Disqus