一、下载IBM Data Server .NET Provider程序 地址

二、安装之后在系统盘可以找到访问数据库的IBM.Data.DB2.dll类库。如:C:\Program Files\IBM\SQLLIB\BIN\netf20\IBM.Data.DB2.dll

三、引用该类库,类库使用文档 
Traditional Chinese IBM Data Server Provider for .NET Programmer's Guide, Informix Edition, v9.7 (SC27-3015-02)

 

示例代码:

string connectionString = "Server=10.11.241.149:52000;DataBase=22;UID=11;PWD=11";
string commandtext = "select * from view_BJGS fetch first 10 rows only";
IBM.Data.DB2.DB2Connection connection = new IBM.Data.DB2.DB2Connection(connectionString);
connection.Open();
IBM.Data.DB2.DB2Command command = new IBM.Data.DB2.DB2Command(commandtext, connection);
IBM.Data.DB2.DB2DataAdapter adapter = new IBM.Data.DB2.DB2DataAdapter(command);
DataSet ds = new DataSet();
adapter.Fill(ds);
connection.Close();