yann_lo_san
Messages postés1137Date d'inscriptionlundi 17 novembre 2003StatutMembreDernière intervention23 janvier 201626 25 oct. 2007 à 21:09
// De tête, pour un appel de procédure dans sql-Server de ce genre :
// declare @returnValue int
// exec @returnValue = maProc(@p1)
// Une connection
SqlConnection connect = new SqlConnection("connectionString");
connect.Open();
// Une commande
SqlCommand cmd = new SqlCommand(connect);
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "maProc";
// Un parametre de retour
SqlParameter retParam = new SqlParameter("@returnValue", SqlDbType.Int);
retParam.Direction = Direction.ReturnValue;
cmd.Parameters.Add(retParam);
// Un parametre normal
cmd.Parameters.Add("@p1", SqlDbType.VarChar).value = "test";