jgerbitz
asked on
Question about adding DataColumn to DataTable
Hi,
I am trying to add DataColumns to a DataTable in c# (vs 2005):
dtAddPatient.Columns.Add(" dcPatientL astName", System.Type.GetType("Syste m.String") );
The whole line is underlined. There are 2 errors:
1) When hovering over the column name: Argument '1': Cannot convert from 'System.Data.DataColumn' to 'string'.
2) When hoving over the rest of the line: The best overloaded method match for 'System.Data.DataColumnCol lection.Ad d(string, System.Type)' has some invalid arguments.
I've seen it done like this elsewhere, so I don't have an idea what I'm doing wrong.
Appreciate any help!
I am trying to add DataColumns to a DataTable in c# (vs 2005):
dtAddPatient.Columns.Add("
The whole line is underlined. There are 2 errors:
1) When hovering over the column name: Argument '1': Cannot convert from 'System.Data.DataColumn' to 'string'.
2) When hoving over the rest of the line: The best overloaded method match for 'System.Data.DataColumnCol
I've seen it done like this elsewhere, so I don't have an idea what I'm doing wrong.
Appreciate any help!
ASKER
Thanks, but still getting the same errors.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Yikes... my fault: the format in my original post worked, but the error isn't removed until I actually rebuild the solution. I'm new to C#... in VB.NET the design-time errors were removed right away without having to rebuild.
Anyway, it seems to be working. I'll give you the points for trying to help out.
Thanks
Anyway, it seems to be working. I'll give you the points for trying to help out.
Thanks
...that should do it