Article ID: 815545 - Last Review: May 13, 2007 - Revision: 1.5 An unhandled exception of the 'System.ArgumentException' type occurs after you rename the columns of a DataSet objectOn This PageSYMPTOMSAfter you rename the columns of a DataTable object in the DataSet, if you try to refer to the columns in case-insensitive manner,
you receive the following exception: An unhandled
exception of type 'System.ArgumentException' occurred in
system.data.dll Additional information: Column 'ColumnName' does not belong to table 'Tablename'. CAUSEWhen you first create a column in a DataTable object of a DataSet, the name is added to two indexes: a case-sensitive index and a
case-insensitive index. When you rename the column in a DataTable object, the new name is not added to the case-insensitive index.
Therefore, when you rename a DataTable column, the ColumnName becomes case-sensitive. RESOLUTIONTo work around this problem after you rename the columns,
copy the Dataset to itself. To do this, rename the columns, and then add the
following statement to the code. Microsoft Visual Basic .NET codeMicrosoft Visual C# .NET codeSTATUS This
behavior is by design. MORE INFORMATIONSteps to reproduce the behavior
REFERENCES For additional information, click
the following article number to view the article in the Microsoft Knowledge
Base: 308656
(http://support.microsoft.com/kb/308656/
)
How to open a SQL Server database by using the SQL Server .NET data provider with Visual Basic .NET
For more information about using .NET Framework data
providers to access data, see the documentation in the Microsoft .NET Framework
Software Development Kit, or visit the following MSDN Web site: http://msdn2.microsoft.com/en-us/library/s7ee2dwt(vs.71).aspx
(http://msdn2.microsoft.com/en-us/library/s7ee2dwt(vs.71).aspx)
APPLIES TO
| Article Translations
|

Back to the top
