I have a function in class A:
public int RecordSummary()
{
int result = 0;
int recordsAffected = 0;
SqlCommand cmd = new SqlCommand("spIATRecordSummary", conn);
cmd.CommandType = CommandType.StoredProcedure;
var returnParameter = cmd.Parameters.Add("@RETURN_VALUE", SqlDbType.Int);
returnParameter.Direction = ParameterDirection.ReturnValue;
try
{
conn.Open();
recordsAffected = cmd.ExecuteNonQuery();
result = Convert.ToInt32(returnParameter.Value);
}
catch (Exception e)
{
MessageBox.Show(e.Message.ToString());
}
finally
{
conn.Close();
}
-- I want to return these two:
return result;
return recordsAffected;
}
I want to get 2 values from this function and return it to two different variables.
From the other class how would I go about populating two variables?
Class B:
int RESULT = RecordSummary();
int RECORDS_AFFECTED = RecordSummary();
I've been reading on tuples and using the out parameter but I'm not sure how the caller will actually retrieve the data. Any help?