You receive "'columnName' is already declared" errors when you build a Visual Basic .NET or Visual Basic 2005 project (818218)
The information in this article applies to:
- Microsoft Visual Basic 2005
- Microsoft Visual Basic .NET (2003)
- Microsoft Visual Basic .NET (2002)
SYMPTOMSYou have an XML schema with elements that have the same name
in different cases (for example, MYELMENT and MyElement). When you generate the DataSet for the XML schema in Visual
Basic .NET or Visual Basic 2005, and you try to build the application that consumes the DataSet, you
receive the following errors: 'columnMYELEMENT' is already
declared as 'Private Dim columnMYELEMENT As System.Data.DataColumn' in this
class. Property 'MYELEMENT' has multiple
definitions with the same signatures. Parameter
already declared with name 'MyElement'. Property 'MYELEMENTColumn' has multiple definitions with the same
signatures. CAUSEWhen you generate a DataSet from an XML schema, an
XMLSchemaName.vb file is also created with the DataSet schema. In the Visual
Basic .NET or Visual Basic 2005 file, the elements of the XML schema are declared as DataColumn. Therefore, there are two declare statements (one for each
element). Because Visual Basic .NET or Visual Basic 2005 is case-insensitive, it cannot distinguish
between the two declare statements that only differ by case. Therefore, you
receive errors when you build the project.RESOLUTIONTo resolve the problem, change the name of the element in
the XML schema. To do this, follow these steps:
- Right-click Schema designer, and then
click View XML Source.
- Replace the element name MyElement with MyElement1.
- On the Build menu, click Rebuild
Solution.
STATUS This
behavior is by design.REFERENCESFor more information, visit the following MSDN Web site:
Modification Type: | Minor | Last Reviewed: | 10/3/2006 |
---|
Keywords: | kbSchema kbXML kbprb KB818218 kbAudDeveloper |
---|
|