funtion parameters and calling from .NET using DAAB

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
fredbest
Posts: 4
Joined: Thu 15 Apr 2010 02:19

funtion parameters and calling from .NET using DAAB

Post by fredbest » Wed 21 Apr 2010 04:10

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

Shalex
Site Admin
Posts: 8248
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Fri 23 Apr 2010 15:47

It is necessary to describe the command to be able to add parameters to the command in any order. Please refer to our documentation.

Post Reply