Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Calling sprocs with input/output parms
Message
De
20/01/2004 12:52:40
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Titre:
Calling sprocs with input/output parms
Divers
Thread ID:
00868624
Message ID:
00868624
Vues:
48
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;
		}
Kendall Webb
Senior Software Engineer
MCAD.Net/MCSD.Net
Répondre
Fil
Voir

Click here to load this message in the networking platform