Click here to Skip to main content
13,799,014 members
Click here to Skip to main content
Add your own
alternative version


41 bookmarked
Posted 29 Mar 2006
Licenced CPOL

Data Application Block for Firebird SQL

, 29 Mar 2006
Rate this:
Please Sign up or sign in to vote.
Data Application Block for Firebird SQL intended to speed the development of applications.

Sample Image - fb_burning_within2.gif


The Firebird SQL data application block is intended to speed up development, and it should be used in conjunction with data layer classes in much the same way as Microsoft’s data block. The sample included with this article uses the embedded Firebird SQL database (included in the sample) to demonstrate the use of the application block without having to bother setting up a database.


Firebird SQL data application block was inspired by the Microsoft Application Blocks. The block provides overloaded methods to query a Firebird database which return a DataSet, DataTable, or an integer in the case of scalar database calls. An additional overload method takes an existing DataSet as a parameter and fills the results of a stored procedure send as the parameter as well.

Using the Code

The block has one class called DBObject. The main class has four main overloaded methods to do the work. The methods need to be accessed after the class has been instantiated passing the connection string to its constructor. The following is a list of the overrun procedures and their purpose:

  • Overload RunProcedure() - returns an integer indicating the return value of the stored procedure, and also returns the value of the RowsAffected aspect of the stored procedure that is returned by the ExecuteNonQuery method.
  • Overload RunProcedure() - returns a FbDataReader containing the result of the stored procedure.
  • Overload RunProcedure() - Creates a DataSet by running the stored procedure and placing the results of the query/proc into the given table name.
  • Overload RunProcedure() - Takes an existing DataSet and fills the given table name with the results of the stored procedure.
// First we declare a a string
// and assign our connection string to it. 
// In a production system, you would be probably
// have this connection in a central repository 
// and have the DBObject get set it from within the class.
string myConnectionString = "User=SYSDBA;Password=masterkey;" + 
                            "Database=EMPLOYEE.FDB;ServerType = 1;"; 

// Instantiate the DBObject class
DBObject myDBObject = new DBObject(myConnectionString);

//Set parameter to the DBObject class. Note that to keep it simple 
//the store procedure in this case doesn’t take any parameters.
//There is an example with parameter s in the sample code for this article.
//Also, notice that I bind the dataset 
//the RunProcedure() method returns to a datagrid.
dataGridView1.DataSource = 
myDBObject.RunProcedure("ORG_CHART ", 
       new IDataParameter[] { }, "tblMyDataTable");
dataGridView1.AutoGenerateColumns = true;
this.dataGridView1.DataMember = "tblMyDataTable";

Points of Interest

Well, I hope that you find this code useful. I have used the data block in conjunction with the embedded version of Firebird SQL for many of my stand-alone applications. I especially like the fact that the applications work out of the box without the need for additional installations. It makes deployment a breeze since the database is included in the application itself, and all it takes is a couple of DLLs with a very small footprint.


This article was first submitted to CodeProject on 03/29/2006.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Web Developer
United States United States
No Biography provided

You may also be interested in...


Comments and Discussions

GeneralPlease Help Pin
softhut28-Jun-09 14:38
membersofthut28-Jun-09 14:38 
AnswerGreat job Pin
Kelly Cristina Mara8-Feb-08 12:34
memberKelly Cristina Mara8-Feb-08 12:34 
GeneralRe: Great job Pin
Donsw21-Feb-09 5:54
memberDonsw21-Feb-09 5:54 
GeneralCool Pin
Member 966-Apr-06 7:16
memberMember 966-Apr-06 7:16 
GeneralRe: Cool Pin
Xela2206-Apr-06 14:32
memberXela2206-Apr-06 14:32 
Generalnice Pin
AnasHashki29-Mar-06 22:29
memberAnasHashki29-Mar-06 22:29 
GeneralRe: nice Pin
Xela22030-Mar-06 4:02
memberXela22030-Mar-06 4:02 
GeneralSample link is broken Pin
Marcelo R29-Mar-06 9:51
memberMarcelo R29-Mar-06 9:51 
GeneralRe: Sample link is broken Pin
Xela22029-Mar-06 12:39
memberXela22029-Mar-06 12:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web01 | 2.8.181207.3 | Last Updated 29 Mar 2006
Article Copyright 2006 by Xela220
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid