Click here to Skip to main content
16,016,580 members
Articles / Web Development / ASP.NET

DuplicateNameException when adding columns to a DataTable dynamically

Rate me:
Please Sign up or sign in to vote.
4.00/5 (1 vote)
24 Jun 2011CPOL 26.7K  
When building an ADO.NET DataTable dynamically in your code, each column name must be unique or you get a System.Data.DuplicateNameException. If you don't know at design time that the columns you will be adding are certain to have unique names, you can use this method to avoid a runtime error.

Views

Daily Counts

License

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


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions