Page 1 of 1

funtion parameters and calling from .NET using DAAB

Posted: Wed 21 Apr 2010 04:10
by fredbest
Hi guys,
if have a PGSQL function called

Code: Select all

function Getcurrentworkflows(detnumber text, onlyformanager integer, sall integer)
in C# I am calling this with

Code: Select all

Database db = DatabaseFactory.CreateDatabase();
string sqlCommand = "Getcurrentworkflows";
DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);
db.AddInParameter(dbCommand, "detnumber", DbType.String, "SSSSS");
db.AddInParameter(dbCommand, "onlyformanager ", DbType.Int32, 1);
db.AddInParameter(dbCommand, "sall", DbType.Int32, 1);
DataSet ds = db.ExecuteDataSet(dbCommand);
The above code will work fine becuase the parameters are in the same order as the function.


If I change the order of parameters in C#

Code: Select all

db.AddInParameter(dbCommand, "onlyformanager ", DbType.Int32, 1);
db.AddInParameter(dbCommand, "detnumber", DbType.String, "SSSSS");
db.AddInParameter(dbCommand, "sall", DbType.Int32, 1);
I Get an Error. Does the parameters have to be in order listed in the function or can they be in any order as long as we have the correct parameter names???

TIA

Fred

Posted: Fri 23 Apr 2010 15:47
by Shalex
It is necessary to describe the command to be able to add parameters to the command in any order. Please refer to our documentation.