Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calling Stored Procedure with two parameters
Message
 
 
To
12/10/2010 14:37:47
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
01485066
Message ID:
01485068
Views:
46
>Hi,
>
>I'm trying to adapt this example code from the MM.NET help file to pass in two parameters, one is an input and one an output:
>
>
   // Create the parameter and set the direction
>   IDbDataParameter param1 = this.CreateParameter("@result", 0);
>   param1.Direction = ParameterDirection.Output;
>
>   // Call the stored procedure and pass the parameter
>   IDbCommand cmd;
>   this.ExecSprocScalar("OutputParamTest", out cmd, param1);
>
>   // Retrieve the value from the command object
>   IDbDataParameter param = (IDbDataParameter)cmd.Parameters["@result"];
>   int x = (int)param.Value;
>
>How do I pass the second parameter into
>
>
this.ExecSprocScalar("OutputParamTest", out cmd, param1);
?

Just add a second parameter, e.g.
this.ExecSprocScalar("OutputParamTest", out cmd, param1, param2);
I assume it should work - check overloads for this method - how many parameters does it accept.

May be you'll need to pass parameters as a collection.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform