Forum
Hi Andreas,
mit welchem .net Data Provider arbeitet Ihr? IBM empfiehlt den DB2 .NET Data provider = "DB2 Data Server provider for .net".
Microsoft provides two data providers, the OLE DB .NET Data Provider and ODBC .NET Data Provider. The OLE DB .NET Data Provider is a bridge provider that feeds ADO.NET requests to the IBM OLE DB Provider (by way of the COM interop module). ODBC .NET Data Provider is a bridge provider that feeds ADO.NET requests to the IBM ODBC Driver. These .NET data provider are not recommended for access to DB2 family databases. The IBM Data Server Provider for .NET is a high performance, managed ADO.NET data provider. This is the recommended .NET data provider for use with DB2 family databases. ADO.NET database access using the IBM Data Server Provider for .NET has fewer restrictions, and provides significantly better performance than the OLE DB and ODBC .NET bridge providers.
[code java]
//IBM Data Server Provider for .NET
DB2DataAdapter adapter = new DB2DataAdapter();
//Data adapter object has the following public properties:
//*Â The DeleteCommand deletes records using SQL statements or stored procedures from the data set, for example:
adapter.DeleteCommand = new DB2Command(“DELETE From org WHERE
DEPTNUMB= 10â€, connection);
//*Â The InsertCommand inserts new records into a database using SQL or stored procedures, for example:
adapter.InsertCommand = new DB2Command(“INSERT INTO org VALUES
(30,‘Test’, 60, ‘Eastern’, ‘Toronto’)â€, connection);
//*Â The SelectCommand selects records in a database using SQL or stored procedures, for example:
adapter.SelectCommand = new DB2Command(“SELECT manager FROM org WHERE
DEPTNUMB = 30â€, connection);
//*Â The UpdateCommand updates records in a database using SQL or stored procedures, for example:
adapter.UpdateCommand = new DB2Command(“UPDATE org SET manager=70
WHERE DEPTNUMB=20â€, connection);
//Data Adapter has the following public methods:
//*Â Fill: This fills records in DataSet, as shown below.
DataSet results= new DataSet();
adapter.SelectCommand = new DB2Command("Select * from dept", connection);
adapter.Fill(results);
//*Â Update: This updates records in DataSet and a database through INSERT, UPDATE, and DELETE operations, for example:
DataSet results= new DataSet();
adapter.UpdateCommand = new DB2Command(“UPDATE org SET Manager=70
WHERE DEPTNUMB=20â€, connection);
adapter.Update(results);
[/code]
Viele Grüße
Gernot