Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Calling sprocs with input/output parms
Message
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Divers
Thread ID:
00868625
Message ID:
00868631
Vues:
35
Hi Kendall,

What is the problem you are having? If it returns an error then please include the error as well as which line is occurs on. That way it is easier to figure out what the problem is. Thanks.

>Hi All,
>
>I'm having some difficulty calling a sproc and returning a value. My MM app method code is
>
>
/// <summary>
>		/// Returns a classname (string) from the passed classid (int) parameter
>		/// </summary>
>		public string GetClassName(int key)
>		{
>			// Get a reference to the data access object
>			mmDataAccessBase dao = this.GetDataAccessObject();
>
>			// Create the parameters and set the direction
>			IDbDataParameter param1 = dao.CreateParameter("@ClassID", key);
>			param1.Direction = ParameterDirection.Input;
>			
>			string classname = "trysomejunktexthere";
>
>			IDbDataParameter param2 = dao.CreateParameter("@ClassName",classname);
>			param2.Direction = ParameterDirection.Output;
>
>			// Call the stored procedure and pass the parameters
>			IDbCommand cmd;			
>			this.ExecSprocScalar("ssAPI_getClassName",out cmd, param1, param2);
>
>			// Retrieve the value from the command object
>			IDbDataParameter param = (IDbDataParameter)cmd.Parameters["@ClassName"];
>			string retval = param.Value.ToString();
>
>			return retval;
>		}
>
-----------------------------------------

Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform