0

Using SQL Server CE, I am trying to add a new column to the UserProfile table in ASP.NET Web Pages but keep getting the error when attempting to save the database.

Any ideas?

Database Manager

The constraint cannot be removed because it is referenced by another constraint. [ Constraint name = UserProfile ]

System.Data.SqlServerCe.SqlCeException (0x80004005): The constraint cannot be removed because it is referenced by another constraint. [ Constraint name = UserProfile ]

at System.Data.SqlServerCe.SqlCeCommand.ProcessResults(Int32 hr)
at System.Data.SqlServerCe.SqlCeCommand.ExecuteCommandText(IntPtr& pCursor, Boolean& isBaseTableCursor)
at System.Data.SqlServerCe.SqlCeCommand.ExecuteCommand(CommandBehavior behavior, String method, ResultSetOptions options)
at System.Data.SqlServerCe.SqlCeCommand.ExecuteNonQuery()
at Microsoft.WebMatrix.DatabaseManager.SqlCeDatabase.SqlCeDatabaseProvider.DropTable(TableInfo tableInfo, DbConnection connection, DbTransaction transaction)
at Microsoft.WebMatrix.DatabaseManager.SqlCeDatabase.SqlCeDatabaseProvider.EditTable(String connectionString, String schema, TableInfo tableInfo)
at Microsoft.WebMatrix.DatabaseManager.IisDbManagerModuleService.EditTable(DatabaseConnection databaseConnection, String schema, Object tableInfoData, String configPathState)
at Microsoft.WebMatrix.DatabaseManager.Client.ClientConnection.EditTable(String schema, Object tableInfoData)
at Microsoft.WebMatrix.DatabaseManager.Client.ClientTable.CommitChanges()
at Microsoft.WebMatrix.DatabaseManager.Client.TableDesignerViewModel.PerformSave()

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Sean Dooley
  • 615
  • 2
  • 11
  • 27
  • Opening and editing the database in Visual Studio works. Appears to be an issue only in WebMatrix. Would be interested to know why. – Sean Dooley Jul 30 '12 at 10:50

1 Answers1

0

Sean,

It's a known bug in WebMatrix 2.0RC code. I found a quick workaround, add a row of data, then add your column.

Typically the place to report this kind of issue is at: webmatrix.uservoice.com

Cheers, Yishai

Yishai Galatzer
  • 8,791
  • 2
  • 32
  • 41