Skip site navigation (1) Skip section navigation (2)

Re: OdbcCommand Parameter

From: "Gary Doades" <gpd(at)gpdnet(dot)co(dot)uk>
To: <pgsql-hackers-win32(at)postgresql(dot)org>
Subject: Re: OdbcCommand Parameter
Date: 2004-09-22 17:45:56
Message-ID: 4151C864.18996.242E3F23@localhost (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers-win32
On 22 Sep 2004 at 9:31, Luca Beretta wrote:

> [OdbcException: ERROR [HY000] ERROR: operator does not exist: @@ character varying]
> i think it depends by parameters names, so tried @@param,$param,%param but i get always
> the same exception.
> which is the right mode ?

For ODBC the parameters are positional not named. For C# you would use something 
like the following:

	OdbcCommand cmd = new OdbcCommand();
	cmd.CommandType = CommandType.StoredProcedure;
	cmd.CommandText = "{call LoadCustCliOrders(?,?,?,?)}";



	cmd.Parameters["CUST_ID"].Value = _CustId;
	cmd.Parameters["CLIENT_ID"].Value =  _ClientId;
	cmd.Parameters["DATE_FROM"].Value = _DateFrom;
	cmd.Parameters["DATE_TO"].Value = _DateTo;

	cmd.ExecuteReader (or whatever)...

The names don't matter, you just need to make sure you have the parameters added 
in the same order they appear in your SQL.

This is an example of calling a stored procedure, but the same general principle 
applies to textual SQL statements.

If you need further examples, let me know.


In response to

pgsql-hackers-win32 by date

Next:From: Peter van der MaasDate: 2004-09-23 06:34:20
Subject: installer automation
Previous:From: Magnus HaganderDate: 2004-09-22 11:57:16
Subject: "Operation on non-socket" analysis

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group