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
Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.
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. |
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(); }
Namespace: FirebirdSql.Data.Firebird
Assembly: FirebirdSql.Data.Firebird (in FirebirdSql.Data.Firebird.dll)
FbCommand Members | FirebirdSql.Data.Firebird Namespace