C# 连接到 iSeries
我是一名 iSeries 资深人士,正在使用 C# 和 ASP.Net 扩展到 .Net 世界。我的计算机上加载了 Client Access,并且添加了 IBM.Data.DB2.iSeries.dll 作为参考。我还将该 .dll 添加到了我的工具箱中。
我无法在 ASP.NET 中使用任何 iDB2 内容来连接到 iSeries,因为出现以下错误:
“找不到类型或名称空间 Db2Connection(是否缺少 using 指令或程序集引用)。”我添加了 IBM.Data.DB2.iSeries.dll 作为参考。
如何解决这个问题?
- Windows 7 Ultimate x64
- Visual Studio 2010 SP1
- .Net Framework 4.0
- 客户端访问 V6R1
I am a iSeries Veteran who is expanding into the .Net world using C# and ASP.Net. I have Client Access loaded on my computer and I have added the IBM.Data.DB2.iSeries.dll as a reference.I have also added the .dll to my toolbox.
I cannot use any of the iDB2 stuff in my ASP.NET for connecting to the iSeries, as I get this error:
"The type or namespace Db2Connection could not be found (are you missing a using directive or assembly reference)." I have the IBM.Data.DB2.iSeries.dll added as a reference.
How can this be solved?
- Windows 7 Ultimate x64
- Visual Studio 2010 SP1
- .Net Framework 4.0
- Client Access V6R1
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
不幸的是,IBM.Data.DB2.iSeries 库在您的客户端访问安装中具有许多依赖项。它本身肯定无法工作,并且部署起来很痛苦。您提到您已安装客户端访问权限。有时,并非所有库都安装用于编程数据访问。使用您的磁盘并确保在安装程序的“数据访问”部分下重新安装“.NET 数据提供程序”。
另外,请确保您正在运行最新的 IBM iSeries Service Pack。就您而言,对于 V6R1,在撰写本文时它是 SI42423。
您可以通过此 ftp 地址匿名登录根据需要安装 32 或 64 位版本。
最后,问题也可能与您的连接字符串有关。在您的 web.config 中,您的连接字符串应如下所示:
祝您好运!
Unfortunately the IBM.Data.DB2.iSeries library has many dependencies in your client access installation. It will definitely won't work by itself and it is a pain to deploy. You mentioned that you have client access installed. Sometimes, not all the libraries are installed for programmatic data access. Use your disk and make sure to reinstall the ".NET Data Provider" under the "Data Access" section of the installer.
Also, make sure you are running the latest IBM iSeries Service Pack. In your case, for V6R1, it is SI42423 at the time of this writing.
You can login anonymously @ this ftp address and install the 32 or 64 bit version as needed.
Lastly, problem might also be related to your connection string. In your web.config your connection string should look like this:
Good Luck!
您的代码隐藏(.cs 文件)中是否有
using IBM.Data.DB2.iSeries
?Do you have
using IBM.Data.DB2.iSeries
in your code-behind (the .cs file)?您需要使用 iDB2Connection。 DB2Connection 类由 DB2 LUW 使用。
You need to use iDB2Connection. The DB2Connection class is used by DB2 LUW.