funtion parameters and calling from .NET using DAAB

funtion parameters and calling from .NET using DAAB

Postby 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
fredbest
 
Posts: 4
Joined: Thu 15 Apr 2010 02:19

Postby 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.
Shalex
Devart Team
 
Posts: 7654
Joined: Thu 14 Aug 2008 12:44


Return to dotConnect for PostgreSQL