Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calling Stored Procedure with two parameters
Message
 
 
To
13/10/2010 10:26:25
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
01485066
Message ID:
01485297
Views:
29
>>>>>>>Can you post the line to call a method as the above was the one I posted.
>>>>>>
>>>>>>Whoever posted it, that is what worked
>>>>>
>>>>>Ok, just wanted to be sure. How many parameters does this method have?
>>>>
>>>>I'm not sure why you are interested as I have solved my problem, but there are 5 overrides for this method:
>>>>
>>>>ExecSprocScalar(string)
>>>>ExecSprocScalar(string, out System.Data.IDbCommand, params System.Data.IDbDataParameter[])
>>>>ExecSprocScalar(string, params System.Data.IDbDataParameter[])
>>>>ExecSprocScalar(string, string, out System.Data.IDbCommand, params System.Data.IDbDataParameter[])
>>>>ExecSprocScalar(string, string, params System.Data.IDbDataParameter[])
>>>
>>>I'm not sure I understand exactly, that's why I'm asking. We're using 2nd overload (I guess), but we're passing 4 parameters. How does it exactly work, e.g. why
>>>
>>>param1, param2 is the same as params IDbDataParameter[] ?
>>>
>>>E.g. how does C# understand it (as I know the same works for main program).
>>
>>Anyone can please clarify?
>
>ExecSprocScalar if used in a mmbusiness object is an mm method. The IdbDataParameter[] is a collection of parameters. You can add as many parameters as needed to support your stored procedure. You can use the mm method of this.CreateParameter("@paramName", value) as many times as needed sperated by commas to fill that collection.
>
>
>return this.ExecSprocScalar("SPMyStoredProcedureName", 
>     this.CreateParameter("@Param1", value1),
>     this.CreateParameter("@Param2", value2));
>
>
>I hope that was what you are asking.
>Tim

How exactly IdbDataParameter[] and Param1,Param2 correspond - this is the problem I'm not exactly getting. I know it works, but how C# knows to translate value1, value2 into array of values?

In VFP that will not work, for example.
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