Dear all,
Please help me how to get output value from procedure in asp.net
This is my Code---
public bool SaveLoggedUser_Info (string CommandName, DTO_LoggedUserInfo lgUser )
{
SqlParameter[] param = new SqlParameter[]
{
new SqlParameter("@ACTLOG_ID",lgUser.ACTLOG_ID),
new SqlParameter("@LOG_CATEGORY",lgUser.LOG_CATEGORY),
new SqlParameter("@USR_ID",lgUser.USR_ID),
new SqlParameter("@USR_NAME",lgUser.USR_NAME),
new SqlParameter("@LOG_STATUS",lgUser.LOG_STATUS),
new SqlParameter("@SYS_IP",lgUser.SYS_IP),
new SqlParameter("@SYS_NAME",lgUser.SYS_NAME),
new SqlParameter("@LOG_ACTION",lgUser.LOG_ACTION),
new SqlParameter("@USR_OFFLINE",lgUser.USR_OFFLINE),
new SqlParameter("@SESSION_ID",lgUser.SESSION_ID),
new SqlParameter("@TRANSTYPE",lgUser.TRANSTYPE)
};
param[0].Direction = ParameterDirection.Output;
param[0].Size = 20;
dtCommon = new DataTable ( );
return SqlDbHelper.ExecuteNonQuery ( CommandName, CommandType.StoredProcedure, param );
}
SqlDbClass....................
internal static bool ExecuteNonQuery ( string CommandName, CommandType cmdType, SqlParameter[] pars )
{
int Result = 0;
using ( SqlConnection con = new SqlConnection ( ConStr ) )
{
using ( SqlCommand cmd = con.CreateCommand ( ) )
{
cmd.CommandType = cmdType;
cmd.CommandText = CommandName;
cmd.Parameters.AddRange ( pars );
try
{
if ( con.State == ConnectionState.Open )
{
con.Close ( );
}
con.Open ( );
Result = cmd.ExecuteNonQuery ( );
con.Close ( );
}
catch ( Exception ex )
{
throw;
}
}
return (Result > 0);
}
}