ComponentOne DataObjects for .NET
BeforeFetch Event

C1.Data.2 Assembly > C1.Data Namespace > C1DataSetLogic Class : BeforeFetch Event
Fired before a table view is fetched from the database.
Syntax
'Declaration
 
Public Event BeforeFetch As FetchEventHandler
public event FetchEventHandler BeforeFetch
Event Data

The event handler receives an argument of type FetchEventArgs containing data related to this event. The following FetchEventArgs properties provide information specific to this event.

PropertyDescription
For a bound or SQL-based table, the IDbCommand object containing the generated SQL SELECT statement. This argument is null for an unbound table.  
Filter conditions used to fill the data set. These are all filter conditions for all table views in the data set. You need to extract the filter conditions for the particular table view from this argument.  
The reader object providing the fetched data.  
The generated SQL SELECT statement.  
Success or failure status of the operation. In events occurring before operation and allowing to change the status argument, user code can change the status to indicate whether to proceed with the operation, skip or abort it.  
Returns the table collection of the data set being populated.  
The table view being populated.  
Returns the table views collection of the data set being populated.  
Remarks
This event is mainly intended for populating unbound tables. Unbound table fetch is performed in the event code. To provide data, you must create a data reader implementing the System.Data.IDataReader interface and assign it to the Reader argument. C1DataObjects provides a helper class UnboundDataReader that you can use to create your reader. If you have your data in the form of a System.Data.DataTable, create an UnboundDataReader passing the DataTable object to its constructor. You can also create standard .NET Framework or third-party objects implementing IDataReader, such as OleDbReader or SqlDataReader, or implement your own custom data reader, if necessary.

Before any BeforeFetch events are fired for individual table views, a BeforeFetch event is fired for the whole fetch session, with the TableView argument set to null (Nothing in Visual Basic). Use this event to execute code before any table views are fetched.

See Also

Reference

C1DataSetLogic Class
C1DataSetLogic Members
Bound, SQL-Based and Unbound Tables