本文介绍了程序出错请帮我调试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 报告处理期间发生错误。 调用目标引发异常。 程序或功能'rpt_Expected_Repayment'期望参数'@ZGROUP',这是未提供的。 protected void btn_Create_Click( object sender,EventArgs e) { /// 贷款处理开始 string str; str = ConfigurationManager.ConnectionStrings [ ApplicationServices]。ConnectionString; SqlConnection sqlCon = new SqlConnection(str); try { sqlCon.Open(); SqlCommand SqlCmd = new SqlCommand( rpt_Expected_Repayment ,sqlCon); SqlCmd.CommandType = System.Data.CommandType.StoredProcedure; DropDownList1.Focus(); // 创建并提供输出参数 SqlCmd.Parameters.AddWithValue( @ ZGROUP,SqlDbType.VarChar).Value = DropDownList1。文本; SqlCmd.Parameters.AddWithValue( @ CMONTH,SqlDbType.Int).Value = ddl_Period.Text; SqlCmd.Parameters.AddWithValue( @ CYEAR,SqlDbType.Int).Value = ddl_Year.Text; SqlCmd.Parameters.Add( @ RETURN ,System.Data.SqlDbType.VarChar, 12 ); SqlCmd.Parameters [ @ RETURN]。Direction = System.Data.ParameterDirection。输出; SqlCmd.ExecuteNonQuery(); string result = SqlCmd.Parameters [ @ RETURN] Value.ToString(); result = SqlCmd.Parameters [ @ RETURN]。值。的ToString(); if (result == 是) { lblStatus.Text = 预期还款完成; lblReport.Text = 预期还款; } else if (result == NO) { lblStatus.Text = 预期还款已中止; lblReport.Text = 预期还款已中止; } } catch (例外情况) { lblStatus.Text = ex.Message; } 最后 { 解决方案 An error has occurred during report processing.Exception has been thrown by the target of an invocation.Procedure or function 'rpt_Expected_Repayment' expects parameter '@ZGROUP', which was not supplied.protected void btn_Create_Click(object sender, EventArgs e) { ///LOAN PROCESSING BEGINS string str; str = ConfigurationManager.ConnectionStrings["ApplicationServices"].ConnectionString; SqlConnection sqlCon = new SqlConnection(str); try { sqlCon.Open(); SqlCommand SqlCmd = new SqlCommand("rpt_Expected_Repayment", sqlCon); SqlCmd.CommandType = System.Data.CommandType.StoredProcedure; DropDownList1.Focus(); //Create and supply the output parameters SqlCmd.Parameters.AddWithValue("@ZGROUP", SqlDbType.VarChar).Value = DropDownList1.Text; SqlCmd.Parameters.AddWithValue("@CMONTH", SqlDbType.Int).Value = ddl_Period.Text; SqlCmd.Parameters.AddWithValue("@CYEAR", SqlDbType.Int).Value = ddl_Year.Text; SqlCmd.Parameters.Add("@RETURN", System.Data.SqlDbType.VarChar, 12); SqlCmd.Parameters["@RETURN"].Direction = System.Data.ParameterDirection.Output; SqlCmd.ExecuteNonQuery(); string result = SqlCmd.Parameters["@RETURN"].Value.ToString(); result = SqlCmd.Parameters["@RETURN"].Value.ToString(); if (result == "YES") { lblStatus.Text = "Expected Repayment Done"; lblReport.Text = "Expected Repayment Done"; } else if (result == "NO") { lblStatus.Text = "Expected Repayment Aborted"; lblReport.Text = "Expected Repayment Aborted"; } } catch (Exception ex) { lblStatus.Text = ex.Message; } finally { 解决方案 这篇关于程序出错请帮我调试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-28 09:47