1. Introduction:

Welcome to ER DBManager.NET®. This documentation helps you understand ER DBManager.NET® and how to integrate the library into your applications.

DBManager is a library that is used to perform database(MS SQL, Oracle, Oledb, Odbc) operation (Connecting DB, Executing Command, Reading Data, Reading Output parameter, Executing DataSet etc) more easily in Microsoft™ .NET Platform.


2. Download and Integration:
You can download this ERDBManger form following link.

2.1 Download:
ERDBManager.dll
http://nchc.dl.sourceforge.net/project/erdbmanager/ERDBManager.dll

Source Code of ERDBManager.dll.
http://nchc.dl.sourceforge.net/project/erdbmanager/ERDBManagerSource.zip


2.2 Integration:
You can easily integrate this ERDBManager.dll in your project by doing following steps;

1. Select your Project
2. Select Reference from the project explorer
3. Right click the reference
4. Add reference
5. Now select Brows tab
6. Now specify the ERDBManager.dll form your hard drive
7. Make it copy local True


3. Getting Started
This is the easiest way to add ERDBManager to your project. Just execute following steps.

3.1 Download ERDBManager.dll (according to 2.1)
3.2 Add reference of ERDBManager to your project (according to 2.2)

3.3 Start Coding:

After adding reference you need to do following.
Add following namespace.

using ERDBManager;



Now you need to do following things;
1. Create DBManager instance
2. Open Connection
3. Perform Your Operation
4. Close Connection
5. Dispose DBManger object

Now create DBManager instance
DBManager oDBManager = new DBManager();

//Opening Connection
oDBManager.Open();
/Perform Your Operation/
oDBManager.ExecuteNonQuery(CommandType.Text, “your query”);
//Closing Connection
oDBManager.Close();
//Disposing DBManager
oDBManager.Dispose();
More details you will find later.

Preconditions
.NET Framework 2.0 or later version is installed
The framework is installed during the installation of Visual Studio 2005/2008.

SQL Server 2005 Express or other database is installed and running.


4. Building Application with ERDBManager
Let we describe all features of ERDBManger before developing our first Application.
4.1 Understanding ERDBManager
Initialize DBManger.
We can initialize DBManager in following ways.
a. DBManager oDBManager = new DBManager();
b. DBManager oDBManager = new DBManager(DataProvider.SqlServer);
c. DBManager oDBManager = new DBManager(DataProvider.SqlServer, "Connection string");

Description:
a. If we use DBManager oDBManager = new DBManager();
Then it will initialize with DataProvider.SqlServer and retrieve connection string from App.config or web.config file.(From “DBConString” under connectionStrings)

If you want use this then you need to add following code in App.config or Web.config file
<connectionStrings>
<add name="DBConString" connectionString="User ID=sa; Password=###; Persist Security Info=true;Data Source=urDataSource;Initial Catalog=Your DBName"/>
</connectionStrings>
b. If we use DBManager oDBManager = new DBManager(DataProvider.SqlServer);
Then it will initialize with DataProvider.SqlServer and Retrieve connection string from App.config or web.config file as described in a.
c. If we use DBManager oDBManager = new DBManager(DataProvider.SqlServer,”connection string”); Then it will initialize with given connection string and data provide.
Opening Connection:
Just use following code for opening connection.
oDBManager.Open();
Beginning Transaction:
If you need to maintain transaction then you can begin transaction in following way.
//Begin Transaction If Needed
oDBManager.BeginTransaction();
Adding Parameter:
If you need to add parametr value then you need do following thing
//Create Parameters If Needed
//You must add following code before adding parameter
oDBManager.CreateParameters();

//Adding Input Parameter Value
oDBManager.AddParameters("@studentName", “value”);
//Adding Output Parameter Value
oDBManager.AddOutParameters("@studentId", 10);
Getting Parameter Value:
string strStudentId = oDBManager.GetParameterValue("@studentId");
Execuiting Command:
We can execute command from DataBase Store Procedure or SQL string Command.
// Execuiting from StoredProcedure
// Parameter Must be added before execuiting command
oDBManager.ExecuteNonQuery(CommandType.StoredProcedure, "studentInfo_insert");
// Execuiting from SQL String Project
// Parameter Must be added before execuiting command
oDBManager.ExecuteNonQuery(CommandType.Text, "sql query");
Execuiting Data Set:
DataTable dt = new DataTable();
dt = oDBManager.ExecuteDataSet(CommandType.Text, "sql Query").Tables0 ;
Execuiting Scaler:
int val =(int) oDBManager.ExecuteScalar(CommandType.Text, "sql query");

Execuiting Rader:
oDBManager .ExecuteReader(CommandType.Text,"sql query");
if(oDBManager.DataReader.Read())
{
txtStudentName.Text = oDBManager.DataReader[1].ToString();
cmbDepartment.Text = oDBManager.DataReader[2].ToString();
}
oDBManager.DataReader.Dispose();

Commiting Transaction
//Commiting Transaction If Transaction is Begin
oDBManager.CommitTransaction();

Closing Connection:
//Closing Connection
oDBManager.Close();

Disposing Memory
//Disposing DBManager
oDBManager.Dispose();
Hope operation fo DBManager is clear.

Last edited Oct 15, 2010 at 8:21 AM by hasibul2363, version 1

Comments

No comments yet.