Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.ArgumentException: Cannot remove this column, because it is a part of the constraint Constraint1 on the table . at System.Data.DataColumnCollection.CanRemove #3023

Closed
pyliakm opened this issue Jul 11, 2019 · 4 comments

Comments

@pyliakm
Copy link

pyliakm commented Jul 11, 2019

Issue Title

System.ArgumentException: Cannot remove this column, because it is a part of the constraint Constraint1 on the table . at System.Data.DataColumnCollection.CanRemove

General

.Net core 2.2
Windows 10 Version 1803
Stack trace:
at System.Data.DataColumnCollection.CanRemove(DataColumn column, Boolean fThrowException)
at System.Data.DataColumnCollection.BaseRemove(DataColumn column)
at System.Data.DataColumnCollection.Remove(DataColumn column)
at System.Data.ProviderBase.SchemaMapping.RollbackAddedItems(List`1 items)
at System.Data.ProviderBase.SchemaMapping.SetupSchemaWithKeyInfo(MissingMappingAction mappingAction, MissingSchemaAction schemaAction, Boolean gettingData, DataColumn parentChapterColumn, Object chapterValue)
at System.Data.ProviderBase.SchemaMapping..ctor(DataAdapter adapter, DataSet dataset, DataTable datatable, DataReaderContainer dataReader, Boolean keyInfo, SchemaType schemaType, String sourceTableName, Boolean gettingData, DataColumn parentChapterColumn, Object parentChapterValue)
at System.Data.Common.DataAdapter.FillMappingInternal(DataSet dataset, DataTable datatable, String srcTable, DataReaderContainer dataReader, Int32 schemaCount, DataColumn parentChapterColumn, Object parentChapterValue)
at System.Data.Common.DataAdapter.FillMapping(DataSet dataset, DataTable datatable, String srcTable, DataReaderContainer dataReader, Int32 schemaCount, DataColumn parentChapterColumn, Object parentChapterValue)

Snippet of code:
DataTable cards = new DataTable(); cards.Load(reader);
where reader is SqlDataReader

The problem is related with geography sql data type, if I remove the column with this data type, it works fine.

@carlossanlop
Copy link
Member

@divega is this something your team could help with? If not, do you know who could take a look?

@divega
Copy link

divega commented Jul 22, 2019

Although I don't have enough data to identify this as the direct root cause of the exception, SQL Server spatial types are known not to support .NET Core. So it is possible that this is a duplicate of dotnet/SqlClient#30.

@carlossanlop
Copy link
Member

Moving to dotnet/SqlClient for better visibility and to help determine if it is indeed a dupe or not.

@carlossanlop
Copy link
Member

This issue was moved to dotnet/SqlClient#230

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants