嗨,我正在尝试将一行从 DataTable 复制到另一行,我几乎到处查看,但找不到发生这种情况的原因,我正在使用 ImportRow,但 New DataTable 仍然为空。
这是我找到的类似答案之一,但仍然无法正常工作!:
Dim newTable As New DataTable
Dim dsFrom As New DataTable
For Each DBShoes In list
Dim iShoeID As Integer
iShoeID = DBShoes.sShoes_ID
dsFrom = DBShoes.GetFullShoeDetails(iShoeID)
For Each dr As DataRow In dsFrom.Rows
newTable.Rows.Add(dr.ItemArray)
Next
Next
GridView1.DataSource = newTable
GridView1.DataBind()
错误:输入数组长于此表中的列数。
这是不会崩溃但在 DataTable 中没有添加任何内容的导入: Dim newTable As New DataTable Dim dsFrom As New DataTable
For Each DBShoes In list
Dim iShoeID As Integer
iShoeID = DBShoes.sShoes_ID
dsFrom = DBShoes.GetFullShoeDetails(iShoeID)
For Each dr As DataRow In dsFrom.Rows
newTable.ImportRow(dr)
Next
Next
GridView1.DataSource = newTable
GridView1.DataBind()
Else
谢谢