Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Capture return value from a SP
Message
Information générale
Forum:
ASP.NET
Catégorie:
ADO.NET
Titre:
Capture return value from a SP
Versions des environnements
Environment:
C# 1.1
Database:
MS SQL Server
Divers
Thread ID:
01077504
Message ID:
01077504
Vues:
71
I am having some problems capturing the return value from a SP after I excecute it. Here is the code I use:
SqlConnection oCon = new SqlConnection(this.ConnectionString);
SqlCommand cmd = new SqlCommand("mySP", oCon);
cmd.CommandType = CommandType.StoredProcedure;
SqlParameter oParam = cmd.Parameters.Add("@Id", SqlDbType.UniqueIdentifier);
oParam.Value = myID;
oCon.Open();
cmd.ExecuteNonQuery();
oCon.Close();
I have been raising exceptions within SPs to notify the client that something was not cosher, but I would also like to know how to evaluate the return value from a SP.

Let us assume that for this example the SP looks something like this:
UPDATE myTable SET Name = 'Einar' WHERE Id = @Id
RETURN @@ERROR
Semper ubi sub ubi.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform