Adding a column to a datatable

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
 
T

Teemu Keiski

Hi,

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top