jens

 
Private Archive
LegalContact

archive | ado.net | dotnum | .net | xll | excel
ado.net

AdoDb


Contents in the archive are no longer maintained or supported!

AdoDb for ADO.NET

AdoDb: A connection multiplexer for ADO.NET

AdoDb Features

AdoDb Installation and Usage

Copy Stochastix.Data.dll to your project directory and add a reference to the assembly.

Usage is like any of the other data providers (Sql, Odbc), except that all classes are contained in the Stochastix.Data.AdoDb namespace and begin with AdoDb. If you are unfamilar with ADO.NET, I suggest that you toy around with one of the data providers directly and come back later ;-)

The AdoDb "connection string" is just an abstract name for a data source, which will be defined in a separate configuration file.

I'll give you a few examples in C#, but any .NET language will do:

C#using System; using System.Data; using Stochastix.Data.AdoDb; namespace Examples { class Example { [STAThread] static void Main(string[] args) { // open connection AdoDbConnection adoCon = new AdoDbConnection("dbTodo"); // create a query AdoDbCommand adoCmd = adoCon.CreateCommand(); adoCmd.CommandText = "SELECT * FROM Items"; // execute and read data from query adoCon.Open(); IDataReader reader = adoCmd.ExecuteReader(); reader.Read(); // do something here reader.Close(); // Fill dataset and write to XML IDbDataAdapter adapter = new AdoDbDataAdapter(adoCmd); DataSet ds = new DataSet("Todo"); adapter.Fill(ds); ds.WriteXml("todo.xml"); // Close connection adoCon.Close(); } } }

Now you only need to tell your application what a "dbTodo" database is, and how it can be accessed. This is done in a .NET separate configuration file and can be changed later without recompiling your application.

AdoDb Configuration

To configure the actual data provider and connection parameters, AdoDb uses the .NET configuration files. That is eg. a file called myApp.exe.config for the corresponding myApp.exe application. For ASP.NET, add your configuration to the web.config file. <configSections> describes the classes handling the configuration settings and must follow directly after the <configuration> tag.

A … denotes a line wrap (and indentation in the next line) introduced for readability only.

XML<?xml version="1.0" encoding="utf-8" ?> <configuration> <!-- put this section before all others --> <configSections> <sectionGroup name="stochastix.data.adodb"> <section name="providers" type="Stochastix.Data.AdoDb.Configuration.… AdoDbProvidersSectionHandler,… Stochastix.Data" /> <section name="dataSources" type="Stochastix.Data.AdoDb.Configuration.… AdoDbDataSourcesSectionHandler,… Stochastix.Data" /> </sectionGroup> </configSections> <!-- Configure AdoDb providers and connections --> <stochastix.data.adodb> <providers> <add name="OleDb" namespace="System.Data.OleDb" uniformPrefix="OleDb" assembly="System.Data,… Version=1.0.3300.0, Culture=neutral,… PublicKeyToken=b77a5c561934e089" /> <add name="SqlClient" namespace="System.Data.SqlClient" uniformPrefix="Sql" assembly="System.Data,… Version=1.0.3300.0, Culture=neutral,… PublicKeyToken=b77a5c561934e089" /> </providers> <dataSources> <add name="dbTodo" provider= "SqlClient"connectionString="Server=HOST\SQLINSTANCE;… Database=dbTodoItems;… Trusted_Connection=true" /> </dataSources> </stochastix.data.adodb> </configuration>

AdoDb License

AdoDb is free for any non-commercial use.

AdoDb Download

ADO.NET Data Provider

Some Data Providers for .NET are currently not in the 1.0 Framework or must be downloaded separately:

  • ODBC .NET Data Provider

    See the MySQL page how to solve an issue with MyODBC and ADO.NET.

    For installation and integration with Visual Studio.NET see this article.

    With the 1.1 Beta of the .NET framework, the ODBC provider is available in the System.Data.* namespace.

  • .NET Data Provider for Oracle

    Native interface and smooth integration between Microsoft .NET-connected applications and Oracle databases.

    With the 1.1 Beta of the .NET framework, the Oracle provider is available in the System.Data.* namespace.

  • .NET Data Provider for MySQL

    Follow the above link for a complete overview of MySQL and ADO.NET.

MySQL with ADO.NET

http://support.microsoft.com/default.aspx?scid=kb;en-us;319243

There are several options to use MySQL with ADO.NET. Some possibilities are outlined in an article on the MySQL website. However, I'll try to give a complete list here:

It is also possible to use MySQL with the MyODBC (see above note/fix) and myOLEDB driver.

MySQL Migration (from/to SQL Server 2000)

MySQL -> SQL Server 2000

SQL Server -> MySQL

  • See MySQL.com

More ADO.NET Links


lorem ipsum

Copyright © 1994-2004 J. Thiel