完整的错误提示是:
用户代码未处理 System.Data.SqlClient.SqlException
Message="DELETE 语句与 COLUMN REFERENCE 约束 'FK_Class_Teacher' 冲突。该冲突发生于数据库 'ST_DataBase',表 'Class', column 'Class_teacher_id'。\r\n语句已终止。"
Source=".Net SqlClient Data Provider"
ErrorCode=-2146232060
Class=16
LineNumber=1
Number=547
Procedure=""
Server="127.0.0.1"
State=0
StackTrace:
在 System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
在 System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
在 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
在 System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
在 System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async)
在 System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
在 System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
在 St_Teacher.Gv_teach_RowDeleting(Object sender, GridViewDeleteEventArgs e) 位置 f:\bysj2\St_teacher.aspx.cs:行号 68
在 System.Web.UI.WebControls.GridView.OnRowDeleting(GridViewDeleteEventArgs e)
在 System.Web.UI.WebControls.GridView.HandleDelete(GridViewRow row, Int32 rowIndex)
在 System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup)
在 System.Web.UI.WebControls.GridView.RaisePostBackEvent(String eventArgument)
在 System.Web.UI.WebControls.GridView.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
在 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
在 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)