X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 71FDED1B4CB for ; Fri, 12 Mar 2004 08:02:31 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 22447-01 for ; Fri, 12 Mar 2004 04:02:18 -0400 (AST) Received: from gpdnet.co.uk (gpdnet.plus.com [212.56.100.243]) by svr1.postgresql.org (Postfix) with ESMTP id 168EBD1C4EB for ; Fri, 12 Mar 2004 04:02:14 -0400 (AST) Received: from Spooler by gpdnet.co.uk (Mercury/32 v4.01a) ID MO000CA5; 12 Mar 2004 08:04:27 -0000 Received: from spooler by gpdnet.co.uk (Mercury/32 v4.01a); 12 Mar 2004 08:04:10 -0000 Received: from gary (192.168.1.2) by gpdnet.co.uk (Mercury/32 v4.01a) with ESMTP ID MG000CA4; 12 Mar 2004 08:04:05 -0000 From: "Gary Doades" To: pgsql-odbc@postgresql.org Date: Fri, 12 Mar 2004 08:04:04 -0000 MIME-Version: 1.0 Subject: ODBC int2 Paremeters to PostgreSQL functions Message-ID: <40516EF4.2445.73F5669B@localhost> X-mailer: Pegasus Mail for Windows (v4.12a) Content-type: Multipart/Alternative; boundary="Alt-Boundary-823.1945462427" X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200403/36 X-Sequence-Number: 3838 --Alt-Boundary-823.1945462427 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body I have a problem with passing parameters to a PostgreSQL function using the ODBC driver. I have delcared a PostgreSQL function as: function GENERATE_TIMESHEETS(timestamp,timestamp,smallint,smallint) .... I have a .NET program that uses the following: cmd.CommandText = "SELECT GENERATE_TIMESHEETS(?,?,?,?)"; cmd.Parameters.Add("DATE_FROM",OdbcType.DateTime,8); cmd.Parameters.Add("DATE_TO",OdbcType.DateTime,8); cmd.Parameters.Add("TIME_FROM",OdbcType.SmallInt,2); cmd.Parameters.Add("TIME_TO",OdbcType.SmallInt,2); I then assign the parameter values and execute the statement. PostgreSQL returns an error stating GENERATE_TIMESHEETS(timestamp,timestamp,int4,int4) cannot be found It appears that the ODBC driver is not typecasting the smallint (int2) parameters correctly for the function call. Can anyone shed any light on this? Thanks Gary. --Alt-Boundary-823.1945462427 Content-type: text/html; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body
I have a problem with passing parameters to a PostgreSQL function
using the ODBC driver.

I have delcared a PostgreSQL function as:

function GENERATE_TIMESHEETS(timestamp,timestamp,smallint,smallint)
....

I have a .NET program that uses the following:
cmd.CommandText = "SELECT GENERATE_TIMESHEETS(?,?,?,?)";
cmd.Parameters.Add("DATE_FROM",OdbcType.DateTime,8);
cmd.Parameters.Add("DATE_TO",OdbcType.DateTime,8);
cmd.Parameters.Add("TIME_FROM",OdbcType.SmallInt,2);
cmd.Parameters.Add("TIME_TO",OdbcType.SmallInt,2);

I then assign the parameter values and execute the statement.

PostgreSQL returns an error stating
GENERATE_TIMESHEETS(timestamp,timestamp,int4,int4) cannot be found

It appears that the ODBC driver is not typecasting the smallint (int2)
parameters correctly for the function call.

Can anyone shed any light on this?

Thanks
Gary.
--Alt-Boundary-823.1945462427--