2
Reply

sqldatabase error : procedure or function has too many parameters specified.

kishor choure

kishor choure

Aug 24 2012 2:47 PM
2.3k
This is the store procedure I have written


alter procedure getFees @rid bigint,@rem bigint out
as
begin
Select @rem=(feetbl.f_total-Sum(feedetailstbl.fd_paid))  From FeeTbl inner join  FeeDetailsTbl  On  feetbl.f_Id = feedetailstbl.f_Id and feetbl.r_id=@rid group by feetbl.f_id,feetbl.f_total 
--print @rem
end



This is my code in c# window

public Int64 getRemFees(Int64 r_id)
        {
            Int64 fee = 0;
            try
            {
                string str = "getRemFees";
                scmd.CommandText = str;
                scmd.CommandType = CommandType.StoredProcedure;
                scmd.Connection = scon;
                SqlParameter rid = new SqlParameter("@rid", r_id);
                SqlParameter re = new SqlParameter("@rem", SqlDbType.BigInt);

                scmd.Parameters.Add(rid);
                scmd.Parameters.Add(re);
                scmd.Parameters["@rem"].Direction = ParameterDirection.Output;

                if (scon.State == ConnectionState.Closed)
                    scon.Open();

sdr=  scmd.ExecuteReader();

                if (sdr.Read())
                    fee = Convert.ToInt64(scmd.Parameters["@rem"].Value);

               

                if (scon.State == ConnectionState.Open)
                    scon.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("DataBase Error : " + ex.Message, "Database", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            return fee;

        }

When I run above program then It gives me Error : procedure or function  getFees has too many arguments specified.

Answers (2)