Click here to Skip to main content
15,889,863 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
How will i get output decimal value through parameterize store procedure??
please anybody help me..
Posted

 
Share this answer
 
hi,

SQL
create procedure SPName
(
  @par1 int,
  @outParameter varchar output
)
as 
begin
   --insert upadate query or whatever
   --assign value to outparameter
   set   @outParameter='1.1'

end


in code behind

use code like this
C#
SqlParameter outParameter = new SqlParameter("@outParameter", SqlDbType.VarChar, 255); 
                outParameter.Direction = ParameterDirection.InputOutput;
                outParameter.Value = "";
                _sqlCmd.Parameters.Add(outParameter);
                _sqlCmd.ExecuteScalar();
                _transaction.Commit();
//to get value of out parameter
string outvalue = _sqlCmd.Parameters["@outParameter"].Value.toString();


Hope it will help
Good Luck
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900