INSERT 语句与 COLUMN FOREIGN KEY 约束 'FK_FlowStepPerson_FlowStep' 冲突。该冲突发生于数据库 'Oa_Test',表 'FlowStep', column 'ID'。
语句已终止说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.Data.SqlClient.SqlException: INSERT 语句与 COLUMN FOREIGN KEY 约束 'FK_FlowStepPerson_FlowStep' 冲突。该冲突发生于数据库 'Oa_Test',表 'FlowStep', column 'ID'。
语句已终止。源错误:
行 124: if (ds.Tables[0].Rows.Count<1)
行 125: {
行 126: int re = new DBoperate().ExecuteUpdate("insert into FlowStepPerson values("+stepid+","+ListBox2.Items[i].Value+",0,0)");
行 127: if (re > 0)
行 128: {
源文件: f:\oa\ovm\Flow\StepBind.aspx.cs 行: 126 堆栈跟踪:
[SqlException (0x80131904): INSERT 语句与 COLUMN FOREIGN KEY 约束 'FK_FlowStepPerson_FlowStep' 冲突。该冲突发生于数据库 'Oa_Test',表 'FlowStep', column 'ID'。
语句已终止。]
NS_DBOP.DBoperate.ExecuteUpdate(String sql) +105
Flow_StepBind.btnSure_Click(Object sender, EventArgs e) in f:\oa\ovm\Flow\StepBind.aspx.cs:126
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +104
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5614
语句已终止说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.Data.SqlClient.SqlException: INSERT 语句与 COLUMN FOREIGN KEY 约束 'FK_FlowStepPerson_FlowStep' 冲突。该冲突发生于数据库 'Oa_Test',表 'FlowStep', column 'ID'。
语句已终止。源错误:
行 124: if (ds.Tables[0].Rows.Count<1)
行 125: {
行 126: int re = new DBoperate().ExecuteUpdate("insert into FlowStepPerson values("+stepid+","+ListBox2.Items[i].Value+",0,0)");
行 127: if (re > 0)
行 128: {
源文件: f:\oa\ovm\Flow\StepBind.aspx.cs 行: 126 堆栈跟踪:
[SqlException (0x80131904): INSERT 语句与 COLUMN FOREIGN KEY 约束 'FK_FlowStepPerson_FlowStep' 冲突。该冲突发生于数据库 'Oa_Test',表 'FlowStep', column 'ID'。
语句已终止。]
NS_DBOP.DBoperate.ExecuteUpdate(String sql) +105
Flow_StepBind.btnSure_Click(Object sender, EventArgs e) in f:\oa\ovm\Flow\StepBind.aspx.cs:126
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +104
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5614
解决方案 »
- 有谁能给我解释一下数据库的第二范式
- 如何能筛选出表中重复的记录呢
- select * from table where field = ???? ,表field列允许空,所以怎么查询查询 where field 后面怎么写?是空值的话/
- SQL Server数据库成为紧急模式怎么恢复
- 使用SQL语句为现有表结构增加列
- 请教SQLServer多个数据库互相同步的问题
- 如何把exec得到的结果存入临时表
- sqlserver数据同步问题
- 如何在sysdatabases表中获得用户建立所有数据名并放入ComboBox中(在线等)
- 怎样让sqlserver的cpu占用率提高到100%
- 关于isnull(Sdept,'IS')= 'IS '
- 一个sql语句,在ms sql可以运行,但是在access查找不到数据,大家帮忙看下
问题应该是这样的:
比如有A B2表 A表的id是主键,B表的id是外键 和A表的ID关联 这个时候 如果你在B表的ID插入的值在A表的ID值中不存在 就会出现你这个错误了 。。所以仔细检查你插入的值在'Oa_Test',表 'FlowStep', column 'ID'上存在么?