Copying already filled datatable to empty datatable without changing target datatable's column datatypes

Hi,

I am facing a problem
when I copy the data table to newly created data table, it changes all the data types which I do not want. "dt_tempSql is the datatable that I want to copy to newly created datatable, dt_InputSqlTable from "Build datatable " activity. The datatypes of both datatables are displayed in the pictures and newly created datatable is also seen in the pictures. I read that copy function also change the structure but I also used clone() function and it also changes the data types of columns of dt_InputSqlTable.

Any solution to just copy the data without changing the datatypes of columns of dt_InputSqlTable?

Hi, yes and it is correct.

You built your DataTable but then, you completely overwrite it by re-assigning it with the old DataTable.

At the moment that you assign:

dt_InputSqlTable = dt_tempSql.Copy()

you just throw away all what you did in Build Data Table.

To preserve the types, to a For Each in the old Data Table and use Add Data Row activity and use the options:

image

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.