It seems that my data table have some "double’ (I guess it is because I have rows like: 4,14 etc.) data type inside. I need all my data table to be all string
How do I do that? my data table name is: data_table
I need all that is inside this data table to be string and not double
// Assuming you have a DataTable named data_table
// Create a new DataTable to store the result
DataTable stringDataTable = New DataTable();
// Clone the structure of the original DataTable
stringDataTable = data_table.Clone()
// Use LINQ to copy the data while converting all values to strings
stringDataTable = (From row In data_table.AsEnumerable()
Select stringDataTable.Rows.Add(row.ItemArray.Select(Function(field) field.ToString()).ToArray())).CopyToDataTable()
// Now, the stringDataTable contains all values as strings
' Iterate through each row and convert values to strings
For Each row As DataRow In dataTable.Rows
For Each column As DataColumn In dataTable.Columns
row(column.ColumnName) = row(column.ColumnName).ToString()
Next
Next