Adding a column to a datatable

  • Thread starter Thread starter Tina
  • Start date Start date
T

Tina

I'm doing this...

Dim dt As New DataTable

dt.Columns.Add("AreaGroup", Type.GetType("System.String"))

dt.Columns.Add("Col1", Type.GetType("System.String"))

dt.Columns.Add("Col2", Type.GetType("System.decimal"))

it works ok when I specify System.String but when I specify System.decimal I
get an exception saying...

'dataType' argument cannot be null. Parameter name: dataType

Why?
T
 
Hi,

not sure if it is case-sensitive but type name is "System.Decimal" (Decimal
with the first character in uppercase)
 
Back
Top