Search found 4 matches

by fredbest
Wed 21 Apr 2010 04:10
Forum: dotConnect for PostgreSQL
Topic: funtion parameters and calling from .NET using DAAB
Replies: 1
Views: 1330

funtion parameters and calling from .NET using DAAB

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
by fredbest
Wed 21 Apr 2010 01:45
Forum: dotConnect for PostgreSQL
Topic: data types mappings
Replies: 15
Views: 6751

I have a Date type in Postgresql function parameter.
how do I call the function from .net ???
DateTime ???


[quote="Shalex"][b]PostgreSQL to .NET types mapping table[/b]:
[PostgreSQL:BigInt] --> [.NET:long]
[PostgreSQL:Bit, VarBit] --> [.NET:BitArray]
[PostgreSQL:Uuid] --> [.NET:Guid]
[PostgreSQL:Char, VarChar, Text, Cldr, Inet, MacAddr] --> [.NET:String]
[PostgreSQL:Boolean] --> [.NET:bool]
[PostgreSQL:ByteA] --> [.NET:byte[]]
[PostgreSQL:Oid] --> [.NET:int]
[PostgreSQL:Int2Vector] --> [.NET:Int16[]]
[PostgreSQL:OidVector, OidVector801, oidVector] --> [.NET:int[]]
[PostgreSQL:Date, TimeStamp, TimeStampTZ] --> [.NET:DateTime]
[PostgreSQL:Interval, Interval12] --> [.NET:TimeSpan]
[PostgreSQL:Real(MONO), Money, Double] --> [.NET:double]
[PostgreSQL:Int] --> [.NET:int]
[PostgreSQL:Time, TimeTZ] --> [.NET:TimeSpan]
[PostgreSQL:Real(not MONO)] --> [.NET:float]
[PostgreSQL:Numeric] --> [.NET:Decimal]
[PostgreSQL:SmallInt] --> [.NET:short]
[PostgreSQL:Row] --> [.NET:object]

[b].NET to PostgreSQL types mapping table[/b]:
[.NET:String] --> [PostgreSQL:VarChar]
[.NET:Int64, UInt32] --> [PostgreSQL:BigInt]
[.NET:Boolean] --> [PostgreSQL:Boolean]
[.NET:Double] --> [PostgreSQL:Double]
[.NET:Int32, UInt16] --> [PostgreSQL:Int]
[.NET:DateTime] --> [PostgreSQL:TimeStamp]
[.NET:Single] --> [PostgreSQL:Real]
[.NET:Decimal, UInt64] --> [PostgreSQL:Numeric]
[.NET:Int16, Byte, SByte] --> [PostgreSQL:SmallInt]
[.NET:byte[], PgSqlBlob, char[]] --> [PostgreSQL:ByteA]
[.NET:TimeSpan] --> [PostgreSQL:TimeTZ]
[.NET:PgSqlBox] --> [PostgreSQL:Box]
[.NET:PgSqlCircle] --> [PostgreSQL:Circle]
[.NET:PgSQlLSeg] --> [PostgreSQL:LSeg]
[.NET:PgSqlCursor] --> [PostgreSQL:VarChar]
[.NET:PgSqlPath] --> [PostgreSQL:Path]
[.NET:PgSqlPoint] --> [PostgreSQL:Point]
[.NET:PgSqlPolygon] --> [PostgreSQL:Polygon]
[.NET:PgSqlInterval] --> [PostgreSQL:Interval]
[.NET:PgSqlTimeStamp] --> [PostgreSQL:TimeStamp]
[.NET:PgSqlText] --> [PostgreSQL:VarChar]
[.NET:BitArray] --> [PostgreSQL:VarBit]
[.NET:Guid] --> [PostgreSQL:Uuid]
[.NET:PgSqlRow] --> [PostgreSQL:Row]
[.NET:PgSqlLargeObject] --> [PostgreSQL:LargeObject][/quote]
by fredbest
Fri 16 Apr 2010 01:30
Forum: dotConnect for PostgreSQL
Topic: refcursor
Replies: 3
Views: 1353

Why do I need a transaction??
I am using common piece of code for Oracle, SQL Server & PGSQL
by fredbest
Thu 15 Apr 2010 02:52
Forum: dotConnect for PostgreSQL
Topic: refcursor
Replies: 3
Views: 1353

refcursor

Hi Guys
I have the following function

Code: Select all

CREATE OR REPLACE FUNCTION getcategories() RETURNS refcursor AS
DECLARE cur_OUT refcursor;
BEGIN
	OPEN cur_OUT  FOR
	SELECT  wc.*,'' as CATEGORY
        FROM "WORKFLOWCATEGORY" WC  
	Where wc."WORKFLOWCATEGORY_ID" is null 
	order by wc."SHORTDESCRIPTION";
	RETURN cur_OUT;
END;   
LANGUAGE 'plpgsql'
I am using Enterprise Libraries and the following code in c#.net

Code: Select all

 Database db = DatabaseFactory.CreateDatabase();
string sqlCommand = "GETCATEGORIES";
DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);
DataSet ds = db.ExecuteDataSet(dbCommand);
I get this error
cursor "" does not exist


What Am I doing wrong?? Please Help

using devart trial version - devart.Data.dll version is 5.0.81.0

TIA