I'm having a problem calling a stored procedure in Pervasive, the procedure exists and should only return one integer value:
HTML Code:
CREATE PROCEDURE NextRecID (out :outVal INTEGER)
AS BEGIN
START TRANSACTION;
SELECT max(RecId) INTO :outVal FROM RecId;
set :outVal = :outVal + 1;
update RecId set RecId = :outVal;
COMMIT WORK;
END;
Then in C# I have a function to call the procedure and return the output value:
string s = "";
PsqlConnection con = new PsqlConnection();
con.ConnectionString = ConfigurationManager.ConnectionStrings["PervasiveDB"].ConnectionString;
con.Open();
PsqlCommand command = new PsqlCommand(p, con);
command.CommandType = CommandType.StoredProcedure;
command.Parameters.Add("outval", PsqlDbType.Integer, 0, "outval");
command.Parameters[0].Direction = ParameterDirection.Output;
command.ExecuteNonQuery();
s = command.Parameters[0].Value.ToString();
command.Dispose();
con.Close();
con.Dispose();
return s;
The Connection String is defined in web.config and works in other cases:
<add name="PervasiveDB" connectionString="Server Name=pluto;Database Name=bakvordur;" providerName="Pervasive.Data.SqlClient" />
However this code failes then executing the command.ExecuteNonQuery(); line.
The error message is:
Pervasive.Data.SqlClient.Lna.k: [LNA][Pervasive][ODBC Engine Interface][Data Record Manager]Invalid procedure name.
Any clues on why this does not work?