ylbtech-Error-DB-SQLServer:不能在具有唯一索引“IX_subjects_1”的对象“mdm.subjects”中插入重复键的行。重复键值为 (company)。 |
1.返回顶部 |
1、
“/”应用程序中的服务器错误。
不能在具有唯一索引“IX_subjects_1”的对象“mdm.subjects”中插入重复键的行。重复键值为 (company)。
语句已终止。
说明: 执行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。异常详细信息: System.Data.SqlClient.SqlException: 不能在具有唯一索引“IX_subjects_1”的对象“mdm.subjects”中插入重复键的行。重复键值为 (company)。
语句已终止。
源错误:
行 41: cmd.Parameters.Add(new SqlParameter("@creator", dal.Creator));
行 42: cmd.Parameters.Add(new SqlParameter("@modified_time", dateTime));
行 43: cmd.ExecuteNonQuery();
行 44: con.Close();
行 45: con.Dispose();
|
源文件: d:\sp\stage2-cmis\Sp.CMS.Web\App_Code\SubjectsOpt.cs 行: 43
堆栈跟踪:
[SqlException (0x80131904): 不能在具有唯一索引“IX_subjects_1”的对象“mdm.subjects”中插入重复键的行。重复键值为 (company)。 语句已终止。] System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +3302284 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +736 System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +4061 System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted) +496 System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest) +3303 System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry) +667 System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry) +535 System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +380 SubjectsOpt.Add(SubjectsInfo dal) in d:\sp\stage2-cmis\Sp.CMS.Web\App_Code\SubjectsOpt.cs:43 SysManage_OrganiseUnitSave.InitialPage() in d:\sp\stage2-cmis\Sp.CMS.Web\SysManage\OrganiseUnitSave.aspx.cs:431 SysManage_OrganiseUnitSave.Page_Load(Object sender, EventArgs e) in d:\sp\stage2-cmis\Sp.CMS.Web\SysManage\OrganiseUnitSave.aspx.cs:280 System.EventHandler.Invoke(Object sender, EventArgs e) +0 System.Web.UI.Control.OnLoad(EventArgs e) +106 System.Web.UI.Control.LoadRecursive() +68 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3785 |
版本信息: Microsoft .NET Framework 版本:4.0.30319; ASP.NET 版本:4.7.3062.0
2、
2.返回顶部 |
1、
USE [cmis_v3] GO /****** Object: Index [IX_subjects_1] Script Date: 2020/5/22 19:00:10 ******/ CREATE UNIQUE NONCLUSTERED INDEX [IX_subjects_1] ON [mdm].[subjects] ( [subject_name] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) GO
2、
3.返回顶部 |
4.返回顶部 |
5.返回顶部 |
6.返回顶部 |
作者:ylbtech 出处:http://ylbtech.cnblogs.com/ 本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。 |
Error-DB-SQLServer:不能在具有唯一索引“IX_subjects_1”的对象“mdm.subjects”中插入重复键的行。重复键值为 (company)。