Firebird ADO.NET Provider SDK Documentation - v1.7

FbCommand Class

Represents an SQL statement or stored procedure to execute against a data source. This class cannot be inherited.

For a list of all members of this type, see FbCommand Members.

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         FirebirdSql.Data.Firebird.FbCommand

[Visual Basic]
<ToolboxBitmap, _  ToolboxItem(ToolboxItemType:=System.Drawing.Design.ToolboxItem, ToolboxItemTypeName:="System.Drawing.Design.ToolboxItem, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"), _  Designer(DesignerBaseTypeName:="System.ComponentModel.Design.IDesigner, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", DesignerTypeName:="FirebirdSql.Data.Firebird.Design.FbCommandDesigner, FirebirdSql.Data.Firebird, Version=1.7.0.0, Culture=neutral, PublicKeyToken=fa843d180294369d"), _  DesignerCategory(Category:="Component")>
NotInheritable Public Class FbCommand
    Inherits Component
    Implements IDbCommand, ICloneable
[C#]
[ToolboxBitmap]
[ToolboxItem(ToolboxItemType=System.Drawing.Design.ToolboxItem, ToolboxItemTypeName="System.Drawing.Design.ToolboxItem, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
[Designer(DesignerBaseTypeName="System.ComponentModel.Design.IDesigner, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", DesignerTypeName="FirebirdSql.Data.Firebird.Design.FbCommandDesigner, FirebirdSql.Data.Firebird, Version=1.7.0.0, Culture=neutral, PublicKeyToken=fa843d180294369d")]
[DesignerCategory(Category="Component")]
public sealed class FbCommand : Component, IDbCommand, ICloneable

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Remarks

It's strongly recommend to call Dispose method for free the memory allocated by the Firebird Server, when the command is no more needed.

The FbCommand class provides the following methods for executing commands against a Firebird database:

Method Description
ExecuteReader Executes commands that return rows.
ExecuteNonQuery Executes commands such as SQL INSERT, DELETE, UPDATE, and SET statements.
ExecuteScalar Retrieves a single value (for example, an aggregate value) from a database.

Example

FbConnection connection = new FbConnection(myConnString);
FbTransaction transaction = connection.BeginTransaction()
FbCommand command = new FbCommand("SELECT * FROM employee", connection);

connection.Open();
FbDataReader reader = command.ExecuteReader();

try 
{
    while (reader.Read()) 
    {
        Console.WriteLine(myReader.GetValue(0));
    }
}
finally 
{
    // always call Close when done reading.
    reader.Close();
    // always call Close when done with connection.
    connection.Close();
}
                

Requirements

Namespace: FirebirdSql.Data.Firebird

Assembly: FirebirdSql.Data.Firebird (in FirebirdSql.Data.Firebird.dll)

See Also

FbCommand Members | FirebirdSql.Data.Firebird Namespace