DataTable already belongs to another DataSet

后端 未结 10 1235
滥情空心
滥情空心 2020-12-24 11:14

This error is occuring while adding one datatable from a dataset to another .\"DataTable already belongs to another DataSet.\"

dsformulaValues.Tables.Add(m_D         


        
10条回答
  •  滥情空心
    2020-12-24 11:30

    Try to copy the table with DataTable.Copy() method in case it's not a typed DataSet. This method creates a new instance of the same table so it not gonna belong to any DataSet:

    dim newTable as DataTable = oldTable.Copy() dim dv as DataView = newTable.DefaultView

    dsformulaValues.Tables.Add(m_DataAccess.GetFormulaValues(dv.ToTable.DefaultView.ToTable(False, strSelectedCols)).Tables(0))

提交回复
热议问题