Hi,
I’ve created a local sql db with the following simple table schema
CREATE TABLE [dbo].[Shape]
(
[Id] INT NOT NULL PRIMARY KEY,
[FeatureId] [sys].[geometry] NULL
)
The attached project is a simple attempt to write a feature to this table and to then read it back and display it on the map. However, when I try and read back the features from the MsSql2008FeatureLayer feature source, I get the error:
“An item with the same key has already been added.”
Looking at the database, the records are going in as I would expect and there’s no duplication other than the geometry itself. Here’s a screen shot.
What’s this error about and how can I fix it?
Also, I found that since I have Id as a primary key, I must explicitly update the value as I’ve done in the code or the feature is not written to the db. Since this should be an automatically updated number, do you see any reason why I must be doing this to get it to save?
DatabaseToMap.zip (2.3 MB)
Thanks,
Damian