Hi Stephen,
I get the feeling that you're mixing and matching where you shouldn't be. If you are indeed running the ExecuteScalar() method, what it returns to you is the first column of the first row of the result set returned by the query. But since it looks like you're trying to use parameters to return the RONumber, I'm guessing that this is not what you were expecting ExecuteScalar() to do. If you want to use OUTPUT parameters, they need to be specified as OUTPUT parameters in your Stored Proc and you need to use the Parameter.Direction property to set the direction appropriately (Output or InputOutput). (Also, you didn't say what backend database you're using and whether or not it supports output parameters in Stored Procs.)
~~Bonnie
>I have a SP that receives 12 params in and provides one out. I am following the help, but I am missing something. I get returned the 0, but my SP actually writes the proper RONumber in the db. :)
>
>Code shows:
> IDbCommand cmd;
> this.ExecSprocScalar("Jobs_Insert", out cmd,
> this.CreateParameter("@POnumber", POnumber),
> this.CreateParameter("@CustomerID", CustomerID),
>--sniped --
> this.CreateParameter("@RONumber", 0));
>
>
> // Retrieve the value from the command object
> IDbDataParameter param = (IDbDataParameter)cmd.Parameters["@ROnumber"];
> int x = (int)param.Value;
> return x;
>
>Any ideas?
>
>TIA