AdoDb for ADO.NETAdoDb: A connection multiplexer for ADO.NETAdoDb FeaturesAdoDb Installation and UsageCopy 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 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: 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 ConfigurationTo configure the actual data provider and connection parameters, AdoDb uses the
.NET configuration files. That is eg. a file called A … denotes a line wrap (and indentation in the next line) introduced for readability only. <?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 LicenseAdoDb is free for any non-commercial use. AdoDb DownloadADO.NET Data ProviderSome Data Providers for .NET are currently not in the 1.0 Framework or must be downloaded separately:
MySQL with ADO.NEThttp://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
More ADO.NET Links
|