简体   繁体   中英

C# Connecting to iSeries

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

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:

<add name="AS400Connection" connectionString="DataSource=10.0.0.1;ConnectionTimeout=60;UserID=username;Password=password" providerName="IBM.Data.DB2.iSeries" />

Good Luck!

You need to use iDB2Connection. The DB2Connection class is used by DB2 LUW.

Do you have using IBM.Data.DB2.iSeries in your code-behind (the.cs file)?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM