The .Net DatabaseHandler 1.1 is a simple, free, but yet award winning data provider writen in C# and based on the .Net Framework 1.1 which is capable of handling database operations with different database systems.
Even though this data provider can be used in many database access situations, it was thought to help developers that use different database systems in the same application. It is quite practical to use the same API for accessing MS SQL Server, MySQL and MS Access instead of having to struggle with the different .Net Framework base classes for each one of these databases.
StreetAuthority.com provided feedback on this component, referring that it "is servicing hundreds of thousands of users a month making millions of mysql calls." That was like music to my ears! :)
The .Net DatabaseHandler 1.1 is completely free.
This component was tested with Windows Forms, Web Forms, Web Services and Console applications and is particularly helpful when you must connect to different databases within the same application, because it provides the same API for all of them, saving you the time to add specific database "using" statements and classes.
The .Net DatabaseHandler 1.1 is capable of connecting to the following databases:
- Microsoft SQL Server 2008
- Microsoft SQL Server 2005
- Microsoft SQL Server 2000
- Microsoft MSDE
- Microsoft Access
In order to install and use the DatabaseHandler, you need to follow a few easy steps:
Add the DatabaseHandler.dll assembly file to your project references. If you want to use the .Net DatabaseHandler 1.1 with MySQL, make sure to add the file MySql.Data.dll to the project references too. The file MySql.Data.dll is available in the .Net DatabaseHandler 1.1 download file.
In the class where you want to use the DatabaseHandler, make sure to add the following "using" statement:
Instantiate the data provider with the database type and the correct connection string.
Use one of the supported methods to handle database data.
Currently the DatabaseHandler supports only MS SQL Server, MySQL and MS Access databases and the above described methods. Internally, the DatabaseHandler uses the System.Data.SQLClient for MS SQL Server, MySql.Data for MySQL and System.Data.OleDb for MS Access.
In the case of the method GetDataReader(command), the returned object must be casted into the needed type:
- To get a MS SQLServer DataReader: SqlDataReader reader = (SqlDataReader)provider.GetDataReader(command);
- To get a MySQL DataReader: MySQLDataReader reader = (MySQLDataReader)provider.GetDataReader(command);
- To get MS Access DataReader: OleDbDataReader reader = (OleDbDataReader)provider.GetDataReader(command);
The "command" variable can be a OleDbCommand, SqlCommand or MySqlCommand, depending if you are using MS Access, MS SQL Server or MySQL respectively.
Pay attention to the way parameters are used with the different Command classes. While MS Access and MS SQL Server use @parametername, MySQL uses ?parametername.
This component is not longer being developed.
Download the latest version: .Net DatabaseHandler 1.1 Aug. 26th 2009 with MySql 126.96.36.199