How to get SQL Server stored procedure output parameter C#

I have this code so how to get out parameter value here...

string Proc_CreateWorkingSet = "usp_CustomerInfo";

var parameters = new[] {
          new SqlParameter(){ ParameterName="@WorkTableName", Value="WorkingSet" },
          new SqlParameter(){ ParameterName="@ProcessName", Value=Customer.ProcessName },
          new SqlParameter(){ ParameterName="@SettingName", Value="NORTHSHOREMISCFIELD" },                            
          new SqlParameter(){ ParameterName="@ReturnedSQLCmd", Value=string.Empty, Direction=ParameterDirection.Output},
         };

ClientDatabase.ExecuteStoredProcedureNonQuery(Proc_CreateWorkingSet, parameters);
Logger.LogInfo(parameters[3].Value.ToString());

Upvotes: 0

Views: 85

Answers (1)

Rahul
Rahul

Reputation: 77856

Just use the Value property like below. ToString() returns the parameter name and not value

Logger.LogInfo(parameters[3].Value);

Upvotes: 3

Related Questions