I have a datatable which has a number of rows containing data
Then I need to add some empty datacolumns which I do like this:
When I come to use the datatable I find that these new columns now have datatype String and initial values of ""Code:Dim OT_Hours As New DataColumn("OT_Hours") OT_Hours.DataType = System.Type.GetType("System.Double") OT_Hours.DefaultValue = 0 MyTable.Columns.Add("OT_Hours")
I tested this using:
I need to use these columns for calculationsCode:For Each column As DataColumn In MyTable.Columns Console.WriteLine(column.ColumnName & " is a " & Type.GetTypeCode(column.DataType).ToString) Next
any ideas?
What am I doing wrong?




Reply With Quote