This article introduces the ADO. NET Provider and ADO. NET Provider provided by DB2 9.0 + to support. NET 2.0. If you are interested in this, please take a look at it and it will help you.
Although many of my friends are using. NET for data access, there should be few DB2 users. Occasionally, ODBC or ole db is used.
DB2 9.0 + provides ADO. NET Provider that supports. NET 2.0. Especially for friends who use PureXML to develop XQuery, this function is richer than ole db and ODBC.
I installed DB2 9.5 Express-C.
The development environment is VS 2008, but it is more convenient to use the DB 2005 Visual Studio 9.5 Add-ins of VS 2005.
Code-based access will not be mentioned. Here we will introduce a method of App. Config, Which is google. We cannot find a suitable method. We accidentally hit it and found providerName = "IBM. Data. DB2 ")
Using System;
Using System. Collections. Generic;
Using System. Linq;
Using System. Text;
Using System. Data;
Using System. Diagnostics;
Using System. Data. Common;
Using System. Configuration;
Namespace MarvellousXml. Library. Data
{
/// <Summary>
/// Abstract base class for completing data operations
/// </Summary>
Public class Database
{
Protected string name;
ConnectionStringSettings setting;
Public Database (string name)
{
This. name = name;
This. setting = ConfigurationManager. ConnectionStrings [name];