问题描述:

I have oracle table named Query_Times. So i create TableAdapter using VS2010, and add insert query to it:

INSERT INTO QUERY_TIMES (ID, QRY_TIMESTAMP) VALUES (1, @qry_time)

QRY_TIMESTAMP is timestamp(6) data type.

In code i try to execute query like this:

QUERY_TIMESTableAdapter tblqry_times = new QUERY_TIMESTableAdapter();

tblqry_times.InsertQryTime(currTime);

but i got an error Message=ORA-01036: illegal variable name/number.

How to correctly define parameter to use it in a query?

网友答案:

Oracle uses the : parameter prefix (see http://dotnetfacts.blogspot.com/2009/01/adonet-command-parameters.html)

网友答案:

In oracle you use variables like ':variableName'. This called bind variable. It improves query performance as execution plan gets reuse. So, if you use bind variables, you have to assign its value as well through you front-end code.

相关阅读:
Top