locked
Get value from storage procedure. RRS feed

  • Question

  •  string proce = "SP_Contagem";
                        using (SqlCommand command = new SqlCommand(proce, connection))
                        {
                            command.CommandType = CommandType.StoredProcedure;
                            command.Parameters.Add(new SqlParameter("@Idgrupo", entity.Id_grupo));
                            command.Parameters.Add(new SqlParameter("@DataInicio", entity.DataInicio));
                            command.Parameters.Add(new SqlParameter("@DataFim", entity.DataFim));
                            SqlParameter output = new SqlParameter();
                            output.ParameterName = "@RValue";
                            output.SqlDbType = System.Data.SqlDbType.Int;
                            output.Direction = ParameterDirection.Output;
    
                            command.Parameters.Add(output);
    
                            connection.Open();
                            command.ExecuteNonQuery();
    
                           // string message = output.Value.ToString();
                            int n = output.Value.GetHashCode();
                            this.Details.DiscardChanges();

    im using 2 stored procedures...the "n" value returns the number of cars that are rent...so now i need to take that value and send a message that if its > than 10 there are no cars available if <10 there are cars available and save the rent...

    can some one help plz?

    apriciate anyhelp

    Tuesday, June 7, 2016 9:59 AM

Answers

All replies