I have a data table and I need to fetch the data from the particular column
Actually I am using 2 data tables and from the 3rd data table I need to get the data from the particular column.
How to do it?
This will return a single column from your DataTable
To get data from one specific column and row
Stroutput = dt.Rows(rowindex)(“yourcolumnname”)
To get one entire column as a list of string
Stroutput = ( From row in dt.AsEnumerable() Select Convert.Tostring(row(“ColumnName”)) ) .ToList()
For all functionalities in datatable have a view on this tutorial
It is giving output as tablename
not the required output
Use a For Each Row activity to iterate through the rows in the “dt3” data table.
Within the loop, use the Get Row Item activity to retrieve the value from a specific column.
The Get Row Item activity takes two parameters: the first parameter is the data table variable, and the second parameter is the name or index of the column you want to retrieve the value from.
I don’t have to use for each activity just to iterate one column
dtSelected = dt3.DefaultView.ToTable(False, “ColumnName”)
It will provide a single Column .
you assigned it to the DataTable Right?
Put like This
Here DT_YourColumn is the Output of type DATATABLE
and DT_Input is your Input DATATABLE
but to pass it in add data row I again need to pass it through for each row right??
According to your requirement you need only one entire Column from your actual datatable right?
For that you need not do for each row you will get by doing the above method.
By the way why you are doing add data row?
Also If possible please share the sample input and the expected output
Well I need to pass the columns value into add data row as it contains the data for 2 datatables.
I cannot share the data
You can share the sample input Dummy Input you can create and share and the expected output.
May I know how many rows are there in datatable and how many values are to be passed in add datarow
A small representation or explanation about the datatable will help
If its only one rows and you need aome column data then
dt.Rows(0)("ColumnName").ToString will help