对象不能从 DBNull 转换为其他类型
行 89: protected void btn_save_edit_Command(object sender, CommandEventArgs e)行 90: {
行 91: FormView1.UpdateItem(true);
行 92: //FormView1.DataBind();
行 93: WebClass.Script.Alert("修改成功!");
源文件: d:\桌面\新建文件夹\xugu\stu.aspx.cs 行: 91
堆栈跟踪:
[InvalidCastException: 对象不能从 DBNull 转换为其他类型。]
System.DBNull.System.IConvertible.ToInt32(IFormatProvider provider) +54
System.Convert.ChangeType(Object value, TypeCode typeCode, IFormatProvider provider) +293
System.Web.UI.WebControls.Parameter.GetValue(Object value, String defaultValue, TypeCode type, Boolean convertEmptyStringToNull, Boolean ignoreNullableTypeChanges) +248
System.Web.UI.WebControls.SqlDataSourceView.AddParameters(DbCommand command, ParameterCollection reference, IDictionary parameters, IDictionary exclusionList, String oldValuesParameterFormatString) +547
System.Web.UI.WebControls.SqlDataSourceView.ExecuteUpdate(IDictionary keys, IDictionary values, IDictionary oldValues) +413
System.Web.UI.DataSourceView.Update(IDictionary keys, IDictionary values, IDictionary oldValues, DataSourceViewOperationCallback callback) +78
System.Web.UI.WebControls.FormView.HandleUpdate(String commandArg, Boolean causesValidation) +1151
System.Web.UI.WebControls.FormView.UpdateItem(Boolean causesValidation) +19
stu.btn_save_edit_Command(Object sender, CommandEventArgs e) in d:\桌面\新建文件夹\xugu\stu.aspx.cs:91
System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +75
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +155
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) +4921
--------------------------------------------------------------------------------