找不到类型或命名空间名称“oracle”错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17200790/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
The type or namespace name 'oracle' could not be found error
提问by Nutic
I am building C# Console Application to connect with database and do simple query.
我正在构建 C# 控制台应用程序以连接数据库并进行简单查询。
But when I debug program, I get this error:
但是当我调试程序时,我收到这个错误:
The type or namespace name 'Oracle' could not be found ( are you missing a using directive or an assembly reference? )
I need to use:
我需要使用:
using Oracle.DataAccess.Client;
I have downloaded from Oracle site ODAC pack. Inside I have Install batch file ( i have used it ) but nothing still.
我已经从 Oracle 站点下载了 ODAC 包。在里面我有安装批处理文件(我已经使用过它)但仍然没有。
I am using MS VS2012 Express for Windows Desktop.
我在 Windows 桌面上使用 MS VS2012 Express。
What file should I include when adding a reference ?
添加参考时我应该包含什么文件?
回答by Jon Spokes
Agreed you need to reference :
同意您需要参考:
Oracle.DataAccess.dll
You may need to be careful that you have the right Oracle client installed - if you have the 32bit one then you may need to force your app into 32 bit mode.
您可能需要注意安装了正确的 Oracle 客户端 - 如果您有 32 位客户端,那么您可能需要强制您的应用程序进入 32 位模式。
For distribution you may also want to include all the dependencies in your BIN folder - for 32bit that would look like :
对于分发,您可能还希望在 BIN 文件夹中包含所有依赖项 - 对于 32 位,如下所示:
回答by Mads
In the install location of the pack you downloaded there is
在您下载的包的安装位置有
Oracle.DataAccess.dll
which you should reference. Here is a guidedoing exactly that.
你应该参考。 这是一个指南,正是这样做的。