Given the following stored procedure
CREATE PROCEDURE Test1(out :Value integer, in :Input integer)
AS
BEGIN
SET :Value = :Input;
END
The following code FAILS...
DbConnection conn = PsqlFactory.Instance.CreateConnection();
conn.ConnectionString =
"xxx";DbCommand cmd = PsqlFactory.Instance.CreateCommand();
cmd.CommandType =
CommandType.StoredProcedure;cmd.CommandText = "Test1";
PsqlParameter param = PsqlFactory.Instance.CreateParameter() as PsqlParameter;param.ParameterName = "Input";
param.Direction =
ParameterDirection.Input;param.PsqlDbType = PsqlDbType.Integer;
param.Value = 1;
cmd.Parameters.Add(param);
param = PsqlFactory.Instance.CreateParameter() as PsqlParameter;
param.ParameterName =
"Value";param.Direction = ParameterDirection.Output;param.PsqlDbType = PsqlDbType.Integer;
cmd.Parameters.Add(param);
cmd.Connection = conn;
conn.Open();
try
{
cmd.ExecuteNonQuery();
}
finally
{
conn.Close();
}
Here is the error that's received...
Pervasive.Data.SqlClient.Lna.LnaException: [LNA][Pervasive][ODBC Engine Interface]Parameter Input/Output type does not match stored procedure definition
If the code switches the order of the parameters, or the proc switches them to match the code, it works fine. What is the point of having named parameters in a stored procedure if you have to match the order. This is a huge issue for me. I should not have to write code such that my parameters follow the exact order as they are designated in the procedure.
Please advise.