Tech_Men
asked on
i need to get a value from a Sp
hi there in the sp i have this code :
ALTER PROCEDURE dbo.MelayUpdateTotalquanti ty
(
@ProKey varchar(50),
@Total money output
)
AS
SET NOCOUNT ON
select Sum(Kamot) as Total from MelayActions where CodeParit=@ProKey
RETURN
in the Form i have this code :
public bool GetSumTotal(string ProKey)
{
SqlParameter[] sp = new SqlParameter[2];
sp[0] = new SqlParameter("@ProKey",Sql DbType.Var Char,50);
sp[0].Value = ProKey;
sp[1] = new SqlParameter("@Total",SqlD bType.Mone y);
sp[1].Direction=ParameterD irection.O utput;
SqlDataReader dr = SqlHelper.ExecuteReader(st rCnn,Comma ndType.Sto redProcedu re,"MelayU pdateTotal quantity", sp);
decimal sum =Decimal.Parse(sp["@Total" ].Value.To string());
return true;
}
i cant get the Total Value whit this line : decimal sum =Decimal.Parse(sp["@Total" ].Value.To string());
how can i pull out the Total Value From the Sp to the sum variable ?
thanks ...
ALTER PROCEDURE dbo.MelayUpdateTotalquanti
(
@ProKey varchar(50),
@Total money output
)
AS
SET NOCOUNT ON
select Sum(Kamot) as Total from MelayActions where CodeParit=@ProKey
RETURN
in the Form i have this code :
public bool GetSumTotal(string ProKey)
{
SqlParameter[] sp = new SqlParameter[2];
sp[0] = new SqlParameter("@ProKey",Sql
sp[0].Value = ProKey;
sp[1] = new SqlParameter("@Total",SqlD
sp[1].Direction=ParameterD
SqlDataReader dr = SqlHelper.ExecuteReader(st
decimal sum =Decimal.Parse(sp["@Total"
return true;
}
i cant get the Total Value whit this line : decimal sum =Decimal.Parse(sp["@Total"
how can i pull out the Total Value From the Sp to the sum variable ?
thanks ...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Glad it is working. I didn't test the syntax, sorry
ASKER
thanks .