ODBC int2 Paremeters to PostgreSQL functions

From: "Gary Doades" <gpd(at)gpdnet(dot)co(dot)uk>
To: pgsql-odbc(at)postgresql(dot)org
Subject: ODBC int2 Paremeters to PostgreSQL functions
Date: 2004-03-12 08:04:04
Message-ID: 40516EF4.2445.73F5669B@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

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.

Browse pgsql-odbc by date

  From Date Subject
Next Message Richard Huxton 2004-03-12 08:55:05 Re: MS Access error "could not connect to remote socket"
Previous Message chor kim seng 2004-03-12 07:08:23 MS Access error "could not connect to remote socket"