Team,
I got a datatable with 10 records say
11
22
33 upto 99, 10
I want to store 1st five records in a string with a word ‘or’ in between each record like
11 or 22 or 33 or 44 or 55
Help needed.
Team,
I got a datatable with 10 records say
11
22
33 upto 99, 10
I want to store 1st five records in a string with a word ‘or’ in between each record like
11 or 22 or 33 or 44 or 55
Help needed.
Do these steps,
Hope this is clear
First thing I would do is only select the first 5 records of the table. You can do this with: dt1.AsEnumerable.Take(5)
Then loop through those 5 and append the string like @HareeshMR mentioned
Hello @Robotics you can try below
Log message = String.join(" or ", (From rw in datatable.select().Take(5) select x = rw("ColumnName").tostring).ToList))
It is not necessary that the data inside the datatable will be in the form of 5 or 10 records. May be 1 record, 5 or 10, 6 or 12 etc records will be there.
Assume there are 12 records are there inside a DT
1 to 5 should be stored separately
6 to 10 should be stored separately
11 & 12 stored separately.
dataTable.AsEnumerable().[Select](Function(x) x(“Column1”).ToString()).Aggregate(Function(a, b) String.Concat(a, " or " & b))
I am using the below query to convert one column of my datatable to string array :
String array = (dt2.AsEnumerable().Select(Function(a) a(5).ToString)).ToArray
I need to convert mulitple columns (3 columns from the datatable into string array) using the above query, Please help