Note that there are some explanatory texts on larger screens.

plurals
  1. POOverflowException when getting out parameters from a stored procedure
    primarykey
    data
    text
    <p>I have a store procedure. From this I want output value but there is showing the following error: </p> <blockquote> <p>System.OverflowException: Value was either too large or too small for an Int32.</p> </blockquote> <p>My Store Procedure</p> <pre><code>ALTER proc dbo.[RECnoofDue] @acno varchar(100), @NoofDue numeric(18,2) output as Begin select @NoofDue=isnull(SUM(Avgr),0) from ( select NoOfDue, LHEMI, TotalEMIDue, sunday, Avgr from (SELECT COUNT(LHID) AS NoOfDue, LHEMI, SUM(LHEMI) AS TotalEMIDue, SUM((Case when LHSundryBalance is null then 0 else LHSundryBalance end)) AS sunday, ((SUM(LHEMI)-SUM((Case when LHSundryBalance is null then 0 else LHSundryBalance end))) / LHEMI) AS Avgr FROM dbo.TblLoanHistory WHERE (LHAcNo = @acno) AND (LHEMIPaid = 0 OR LHEMIPaid IS NULL)AND (LHFileStatus IS NULL) GROUP BY LHSundryBalance, LHEMI,LHFileStatus ) x union (SELECT COUNT(LHID) AS NoOfDue, LHEMI, SUM(LHTotalOverDue) AS TotalEMIDue, SUM((Case when LHSundryBalance is null then 0 else LHSundryBalance end)) AS sunday, ((SUM(LHTotalOverDue)-SUM((Case when LHSundryBalance is null then 0 else LHSundryBalance end))) / LHEMI) AS Avgr FROM dbo.TblLoanHistory WHERE (LHAcNo = @acno) AND (LHEMIPaid = 0 OR LHEMIPaid IS NULL) AND (LHFileStatus = 'BK')GROUP BY LHSundryBalance, LHEMI)) bb end </code></pre> <p>My ASP.NET C# Code</p> <pre><code>private double NOofDueCount() { using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["OptimaWebCustomerQueryCon"].ConnectionString)) using (SqlCommand cmd = new SqlCommand("dbo.RECnoofDue", conn)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@acno", SqlDbType.Int); cmd.Parameters.Add("@NoofDue", SqlDbType.Int).Direction = ParameterDirection.Output; cmd.Parameters["@acno"].Value = hfLoanAcNo.Value; conn.Open(); cmd.ExecuteNonQuery(); using (SqlDataReader dr = cmd.ExecuteReader()) { if (dr.Read()) { return Convert.ToDouble(cmd.Parameters["@NoofDue"].Value); //int contractID = Convert.ToInt32(cmd.Parameters["@NoofDue"].Value); } } conn.Close(); return 0; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload