Yerg
Yerg

Reputation: 15

SQL Invalid syntax with OLEDB Oracle (11g) and C#

Here is the query I want to run:

SELECT COUNT(*) FROM Users WHERE name = @name AND pwd = @pwd;

My Connection String:

Provider=OraOLEDB.Oracle;User Id = HR; Password = hr;

Specifications:

Steps I've tried:

Error I'm getting:

ORA-00936: missing expression

Upvotes: 0

Views: 125

Answers (1)

Patrick Hofman
Patrick Hofman

Reputation: 156978

In Oracle, parameters are prefixed with : instead of @. Use that instead:

SELECT COUNT(*) FROM Users WHERE name = :name AND pwd = :pwd;

Upvotes: 1

Related Questions