Firebird ADO.NET Provider SDK Documentation - v1.7

FbDataAdapter Class

Represents a set of data commands and a connection to a data source that are used to fill the DataSet and update the data source. This class cannot be inherited.

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

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Data.Common.DataAdapter
            System.Data.Common.DbDataAdapter
               FirebirdSql.Data.Firebird.FbDataAdapter

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

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

The FbDataAdapter, serves as a bridge between a DataSet and FirebirdSQL for retrieving and saving data. The FbDataAdapter provides this bridge by mapping Fill, which changes the data in the DataSet to match the data in the data source, and Update, which changes the data in the data source to match the data in the DataSet, using the appropriate DSQL statements against the data source.

FbDataAdapter is used in conjunction with FbConnection and FbCommand to increase performance when connecting to a FirebirdSQL Server database.

The FbDataAdapter also includes the SelectCommand, InsertCommand, DeleteCommand, UpdateCommand, and TableMappings properties to facilitate the loading and updating of data.

When an instance of FbDataAdapter is created, the read/write properties are set to initial values.

Example

public static void CreateFbDataAdapter() 
{
    FbConnection    conn = new FbConnection("Database=C:\\PROGRAM FILES\\FIREBIRD\\EXAMPLES\\EMPLOYEE.GDB;User=SYSDBA;Password=masterkey;Dialect=3;Server=localhost");
    FbDataAdapter    custDA = new FbDataAdapter();
    FbTransaction    txn     = conn.BeginTransaction();

    custDA.MissingSchemaAction = MissingSchemaAction.AddWithKey;
   
    custDA.SelectCommand = new FbCommand("SELECT custno, customer FROM CUSTOMER", conn, txn);
    custDA.InsertCommand = new FbCommand("INSERT INTO customer (CustomerID, customer) " +
                                            "VALUES (?, ?)", conn, txn);
    custDA.UpdateCommand = new FbCommand("UPDATE customer SET custno = ?, customer = ? " +
                                            "WHERE custno = ?", conn, txn);
    custDA.DeleteCommand = new FbCommand("DELETE FROM customer WHERE custno = ?", conn, txn);

    custDA.InsertCommand.Parameters.Add("@custno", FbDbType.Int32, 4, "custno");
    custDA.InsertCommand.Parameters.Add("@customer", FbDbType.VarChar, 25, "customer");
 
    custDA.UpdateCommand.Parameters.Add("@custno", FbDbType.Int32, 4, "custno");
    custDA.UpdateCommand.Parameters.Add("@customer", FbDbType.VarChar, 25, "customer");
    custDA.UpdateCommand.Parameters.Add("@oldcustno", FbDbType.Int32, 4, "custno").SourceVersion = DataRowVersion.Original;

    custDA.DeleteCommand.Parameters.Add("@oldcustno", FbDbType.Int32, 4, "custno").SourceVersion = DataRowVersion.Original;
}        
                

Requirements

Namespace: FirebirdSql.Data.Firebird

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

See Also

FbDataAdapter Members | FirebirdSql.Data.Firebird Namespace