Business Logic Framework - Tutorial 1:
Assuming you have a Customer class (as show in the included samples) defined that inherits from the Quick Objects Business Framework class BaseBusinessObject then you can do the following to get a DataSet of all the records in the Customers table.
| private void BindGrid() | |
| { | |
| using (Customers customer = new Customers()) | |
| { | |
| this.GridView.DataSource = customer.Find(); | |
| this.GridView.DataMember = customer.GetResultSetName(); | |
| } | |
| } |
| Private Sub BindGrid() | |
| Using customer As Customers = New Customers() | |
| Me.GridView.DataSource = customer.Find() | |
| Me.GridView.DataMember = customer.GetResultSetName() | |
| End Using | |
| End Sub | |
Alternative Method:
| private void AlternativeMethod() | |
| { | |
| Customers customer = new Customers(); | |
| this.GridView.DataSource = customer.Find(); | |
| this.GridView.DataMember = customer.GetResultSetName(); | |
| customer.Dispose(); | |
| } |
| Private Sub AlternativeMethod() | |
| Dim customer As Customers = New Customers() | |
| Me.GridView.DataSource = customer.Find() | |
| Me.GridView.DataMember = customer.GetResultSetName() | |
| customer.Dispose() | |
| End Sub | |
In the first line we enclosed the Customers object instance creation inside the using statement, this ensures that the Dispose method is called after all the code enclosed in the { } braces is executed. You could alternatively do:
|
|


This example returns every field (that is mapped to a property in the Customer class). Every record in the table is returned.