Checking data types of columns of datatable

Hi,

I want to check datatypes of columns of datatable and when I check in Locals panel, it does not show the datatype of columns. Please guide , how to check it?

Hi @WASEEM_KHAN

Please try this

  • to find the column type of 2nd column

dtTable.Columns(1).DataType.ToString

image

finding datatype of 2 columns

image

Thanks

3 Likes

As an variation for report retrieval:

3 Likes

Thanks for sharing @ppr :grinning: i was also thinking the same but bit different but yours was easy to understand

string.join(",",dtTable.Columns.Cast(of DataColumn).Select(Function(d) d.Columnname.tostring+ ": " +dtTable.Columns(cint(d.ordinal)).DataType.ToString).toarray)

2 Likes

Thanks for the reply. I can see the data types but the problem that I am facing now is, 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



Could you please @prasath_S @ppr help me with this query?

Hi @WASEEM_KHAN

I think you are over writing the 2nd datatable with the first datatable

Please try these steps to copy only the data,

Use foreach row in first datatable,

Use add datarow activity and in datarow give the row variable coming from foreach row

Give datatable in add datarow as 2nd datatable

Thanks

@prasath_S Thanks for replying but I am getting an exception:
aa
cc

Any solution?

It is solved. I just added row variable in “ArrayRow” as row.itemarray.

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