Click here to Skip to main content
Licence CPOL
First Posted 17 Jan 2007
Views 35,284
Downloads 828
Bookmarked 32 times

FireBird SqlHelper - A Data Access Application Block for FireBird

By | 17 Jan 2007 | Article
FireBird.SqlHelper is a C# porting of Microsoft Data Access Application Block V2. Just like the Microsoft Data Access Application Block V2, FireBird.SqlHelper encapsulates performance and resource management best practices and can easily be used as a building block in your own .NET FireBird applicat
Sample Image - FireBirdSqlHelper.jpg

Introduction

FireBird.SqlHelper is a C# porting of Microsoft Data Access Application Block V2. Just like the Microsoft Data Access Application Block V2, FireBird.SqlHelper encapsulates performance and resource management best practices and can easily be used as a building block in your own .NET FireBird application. If you use it, you will reduce the amount of custom code you need to create, test and maintain.

Features

A pre-written data access library is always handy. Basically FireBird SqlHelper has similar features as MSDAB. Following are the important features: The FireBird SqlHelper Data Access Application Block for .NET consists of a single .NET-based assembly, which contains all of the functionality necessary to perform the most common data access tasks against a FireBird database. Specifically, the Data Access Application Block helps you:

  • Call stored procedures or SQL text commands
  • Specify parameter details
  • Return SqlDataReader, DataSet objects, or single values
  • Use strongly typed table and field names
  • Support parameter caching, where required
  • Allow additional tables to be added by passing in pre-existing datasets
  • Update a dataset with user-specified update commands
  • Create SqlCommand objects
  • Allow strongly typed data rows to be passed in place of parameters

Using the Code

Compile FireBird.SqlHelper project and add the reference of FireBird.SqlHelper.dll in your application. Following are the important methods that you could use:

  • ExecuteNonQuery - Executes a command that does not return rows
  • ExecuteDataset - Executes a command that returns rows as a DataSet
  • ExecuteReader - Executes a command that returns rows as a SqlDataReader
  • ExecuteScalar - Executes a command that returns a single value as an object
  • FillDataset - Executes a command that populates a DataSet that is provided as a parameter
  • UpdateDataset - Executes a given command for each inserted, updated, or deleted row in a DataSet
  • CreateCommand - Creates a command object given a stored procedure and parameters
  • ExecuteNonQueryTypedParams - Executes a command that does not return rows using a DataRow’s column values as parameters
  • ExecuteDatasetTypedParams - Executes a command that returns rows as a DataSet using a DataRow’s column values as parameters
  • ExecuteReaderTypedParams - Executes a command that returns rows as a SqlDataReader using a DataRow’s column values as parameters.
  • ExecuteScalarTypedParams - Executes a command that returns a single value as an object using a DataRow’s column values as parameters.

The following code is from the demo application:

private void RefreshData()
{
    this.dataGridView1.DataSource = 
    SqlHelper.ExecuteDataset(SQLHelp.Connectionstring, CommandType.Text, 
    "SELECT * FROM COUNTRY").Tables[0];
}

You could call a stored procedure like:

SqlHelper.ExecuteReader(connectionString, "getProductsByCategory",  categoryID);

You could download MSDAB V2 with documentation from here.

The documentation along with MSDAB covers everything about the SqlHelper class which also applies to FireBird SqlHelper.

There are also a great deal of samples available for MSDAB V2 which you could also use for FireBird SQLHelper.

History

  • 17th January, 2007: Initial post

License

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

About the Author

Rafey

Web Developer

Pakistan Pakistan

Member

Software engineer developing solutions using Microsoft technologies.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralMy vote of 5 PinmemberNazmi Altun7:50 7 Jan '12  
Questionhi,how to update a table Pinmemberyunhai130:50 21 Sep '11  
AnswerRe: hi,how to update a table Pinmemberyunhai1315:52 21 Sep '11  
GeneralYou can get beeter and simple one Pinmembersam4u2u16:34 13 Nov '09  
GeneralFirebird SQLHelper PinmemberbuyValu11:18 11 Dec '07  
GeneralStored Procedures PinmemberbuyValu8:22 5 Jun '07  
QuestionUsing with Visual Studio 2003 pro PinmemberAndrewPoole23:24 30 Jan '07  
Hi Rafey
 
this looks great - just what I needed, I'm trying to use it inside Visual Studio 2003, I cant open it directly so I have created a new project and am trying to import the source. Do you know how I would go about generating the settings designer and resource designer source files?
 
Thanks
 
Confused | :confused:
 
Andrew
AnswerRe: Using with Visual Studio 2003 pro PinmemberRafey23:57 30 Jan '07  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    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 | Mobile
Web01 | 2.5.120529.1 | Last Updated 17 Jan 2007
Article Copyright 2007 by Rafey
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid