Subject Re: [firebird-support] Parameter order to SP
Author Stefan Gustavsson
Hi Tim!

On 4/20/05, Tim Gahnström <tim.gahnstrom@...> wrote:
> I have searched the history of the list looking for more information on how to pass parameters to FireBird Stored Procedures from .NET because it is behaving weird I think but I didn't come up with anything good.
> The way I do it now I like this:
> ---------
> FbCommand("SELECT * FROM SP_GET_MOVIES_ALL(?,?)", con)
> fc.CommandType = CommandType.Text
> fc.Parameters.Add("ICOUNT", 0).Direction = ParameterDirection.Input
> fc.Parameters.Add("ISTART", 2).Direction = ParameterDirection.Input
> Dim fdr As FbDataReader = fc.ExecuteReader()
> ----------

Have you tried something like this?

fc.CommandType = CommandType.Text
fc.Parameters.Add("@ICOUNT", FbDbType.BigInt).Value = 10
fc.Parameters.Add("@ISTART", FbDbType.BigInt)).Value = 2
Dim fdr As FbDataReader = fc.ExecuteReader()

It doesn't matter in which order you will add them :) this is really
convenient especially if
you will combine it with the System.Reflection api so you don't have
to write all those boring
lines with code for just adding parameters.

> This looks simple enough and works well as long as I ad the parameters in the right order. Why do I need to do that? When I pass the names along with parameter? And I have named the parameters in the SP.
> I realize that the parameters need to be in order with a command like this:
> FbCommand("SELECT * FROM SP_GET_MOVIES_ALL(1,2)", con)
> But it seems strange that FB or the .NET dataprovider doesn't handle the named parameters "correct".
> I am using
> FB 1.5
> With
> .NET Dataprovider Version 1.7 RC 2
> Have I misunderstood something or is this just a limitation?
> Thanks
> Tim
> Yahoo! Groups Links

regards, Stefan