1

Trying to create a Web API which queries the Oracle DB which receives the input as array of String.So trying to add Command Parameters

I added the following references System.Data.OracleClient.dll also,

using Oracle.ManagedDataAccess.Client;
using Oracle.ManagedDataAccess.Client.OracleParameter;
using System.Data.OracleClient;
using System.Data.OracleClient.OracleParameter;

But getting error as below enter image description here

`A using namespace directive can only be applied to namespaces; 'Oracle.ManagedDataAccess.Client.OracleParameter' is a type not a namespace

A using namespace directive can only be applied to namespaces; 'System.Data.OracleClient.OracleParameter' is a type not a namespace `

1 Answer 1

5

You are trying to use both Oracle's Oracle client (Oracle.ManagedDataAccess.Client) and Microsoft's Oracle client (System.Data.OracleClient). You should pick one of them. However, I think the Microsoft one is deprecated in more recent .Net Framework releases so you're probably better off with Oracle's implementation.

Sign up to request clarification or add additional context in comments.

12 Comments

Which one should I be adding here
If I just add using System.Data.OracleClient.OracleParameter getting Error 1 A using namespace directive can only be applied to namespaces; 'System.Data.OracleClient.OracleParameter' is a type not a namespace
Exactly. System.Data.OracleClient has been depricated for a LONG time. And it's beyond terrible. If you are using a Web app, I'd use standard ODP.net rather than the managed client. The managed client is fine, but it's missing functionality in the original version such as bulk inserts.
And parameters on System.Data.OracleClient are beyond terrible. Seriously, switch now!
I myself would use the Oracle.ManagedDataAccess.Client because the Microsoft isn't available in the more recent versions of the .Net framework.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.