Error generating report: Column and Column have conflicting properties: DataType property mismatch

0

When trying to populate a datatable dynamically, the error occurs at the time of merge of the other data.

            For Each drw In dtbTemp.Rows
                dtb = obj.Enquadra(drw.Item("IDCON_TMP"), drw.Item("IDCAR_TMP"))
                dtb.Columns.Add("IDCON_CON", GetType(Integer))
                For Each drwTit In dtb.Rows
                    drwTit.Item("IDCON_CON") = drw.Item("IDCON_TMP")
                Next
                dtb.TableName = "Titulo"
                If dst.Tables.IndexOf(dtb.TableName) > -1 Then
                    dst.Merge(dtb)
                Else
                    dst.Tables.Add(dtb)
                End If
                dtb = New DataTable
            Next

The following error is thrown:

Erro ao gerar o relatório: <Coluna> e <Coluna> têm propriedades conflitantes: propriedade DataType incompatível.

I'm getting all the records from the temporary dataTable and handling each row and inserting into a new dataTable.

    
asked by anonymous 27.10.2016 / 21:16

1 answer

0

Use the MissingSchemaAction.Ignore as the parameter in the Merge of the DataSet. This parameter specifies the action to take when adding data to the DataSet and the DataTable or DataColumn is missing. Ignore ignores the extra or conflicting columns.

The code snippet should look like this:

dst.Merge(dtb, True, MissingSchemaAction.Ignore)

True is to preserve changes in the DataTable.

Source: Documentation in msdn.

    
27.10.2016 / 21:30