ORA-01036 illegal variable name/number in

ORA-01036 illegal variable name/number in

Postby quangnd » Thu 28 Jan 2010 07:08

I have this error when run this code:

string sql = "select * from customer_profile where profile_id = :1";
OracleCommand oraCursorCommand = new OracleCommand(sql, conn);
oraCursorCommand.CommandType = CommandType.Text;
oraCursorCommand.Parameters.Add("p1", OracleDbType.Long).Value = 68;

Why? I do not have this error while using ODP.Net!
Posts: 5
Joined: Thu 28 Jan 2010 07:03

Postby StanislavK » Thu 28 Jan 2010 12:24

Please try adding the parameter as follows:

Code: Select all
oraCursorCommand.Parameters.Add("1", OracleDbType.Long).Value = 68;

In dotConnect for Oracle, the names of the OracleParameter instances added to the command should correspond to the parameter names used in the query. Please see the "Using Parameters" topic of our help:
Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Return to dotConnect for Oracle