Introduction
Using the DbConnection, DbDataAdapter and DbCommand makes the code very long and not easy for the eyes.
This class will make it easy to work with arround DataBases, and will shorten the code in atleast 4 more lines for every command.
A simple example
System.Data.DbManager DbMgr = new System.Data.DbManager("System.Data.OleDb", connstring);
DataTable dtUsers = DbMgr.Retrieve("Select * From tblUsers");
String TopUser = DbMgr.Scalar("Select Top 1 UserName From tblUsers").ToString();
DbMgr.Execute("Delete * From tblUsers");
This will create a new DbManager instense with the OleDb data type, return the tblUsers table, return to top first username and will delete all from tblUsers table.
This is done in here in 4 lines where without it, it would have taken atleast 10 lines.
How it works
In every command that is needed to be done by the class, it opens and closes the connection, this to make sure that the connection will stay closed at all times, so that other connections can be made to that source.
To get a more information on how it works you are welcomed to look at the source code.
Creating your own manager
The usage of this class could be done in alot of the data types such as OleDb, Odbc, SqlClient etc., but if you have a problem with it, you are welcomed to create your own manager class, and can derive from the IDbManager interface.