Ciao grazie della tua risposta, si trattava solo di un errore di sintassi nella chiama della funzione, comunque ho risolto nel seguente modo:
public double capInt()
{
BL.Dati.ConfConnessione connessione = new BL.Dati.ConfConnessione();
double res = 0;
using (SqlConnection conn = new SqlConnection(connessione.getConnectionString()))
{
using (SqlCommand comm = new SqlCommand("dbo.CAP_INT", conn))
{
comm.CommandType = CommandType.StoredProcedure;
SqlParameter p1 = new SqlParameter("@valore1", SqlDbType.Decimal);
SqlParameter p2 = new SqlParameter("@valore2", SqlDbType.Decimal);
SqlParameter p3 = new SqlParameter("@valore3", SqlDbType.SmallInt);
SqlParameter p4 = new SqlParameter("@valore4", SqlDbType.SmallInt);
SqlParameter p5 = new SqlParameter("@valore5", SqlDbType.SmallInt);
SqlParameter p6 = new SqlParameter("@valore6", SqlDbType.Int);
//SqlParameter p2 = new SqlParameter("@Result", SqlDbType.Bit);
//p1.Direction = ParameterDirection.Input;
//p2.Direction = ParameterDirection.ReturnValue;
p1.Value = _valore1;
p2.Value = _valore2;
p3.Value = _valore3Int;
p4.Value = _valore4Int;
p5.Value = _valore5Int;
p6.Value = _valore6;
comm.Parameters.Add(p1);
comm.Parameters.Add(p2);
comm.Parameters.Add(p3);
comm.Parameters.Add(p4);
comm.Parameters.Add(p5);
comm.Parameters.Add(p6);
conn.Open();
comm.ExecuteNonQuery();
if (p2.Value != DBNull.Value)
res = (double)p2.Value;
}
}
return res;
}
Grazie ciao!