Click here to Skip to main content
15,886,639 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to add a new column to a datatable with same column name in c#.net.
Posted
Comments
Jegan Thiyagesan 5-Mar-13 4:43am    
What have you tried?

1 solution

You can't - a DataTable.Columns collection requires that all column Names must be unique. You can add a column with a different name but the same header text, or with a different mixture of upper and lower case characters, but the Name must be unique - otherwise it can't determine which one you mean!
 
Share this answer
 
Comments
sruthi sudan 5-Mar-13 5:45am    
ok.. thanks.. but pls tell me any other method to add column with same column name in another way not in datatable...
OriginalGriff 5-Mar-13 6:00am    
You probably can't - no collection which uses names will allow you to have to identical values - it would be like you having the same telephone number as me, and us both expecting only the calls for us to come through.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900