Quick Objects Documentation Akal Tech Logo
Using Strongly Typed Views

Glossary Item Box

Business Logic Framework - Tutorial 32:

Quick Objects Designer now ships with a template that will create business objects for the selected views. This allows you to use the database views in a strongly typed manner. You can even specify complex search criteria or choose what fields are returned.  The code to use the strongly typed view is exactly the same as the rest of the business objects, and the only limitation is that Insert/Updates/Deletes on views are not supported.

using  (ProcessedOrders orders =  new ProcessedOrders())  
{   
    orders.FirstName.ResultSetName =  "First Name";  
    orders.LastName.ResultSetName =  "Last Name";  
    orders.OrderProcessed.ResultSetName =  "Processed?";  
    orders.OrderDate.ResultSetName =  "Date Taken";  
    orders.OrderAmount.ResultSetName =  "Total";  
 
    // you can also hide columns and/or specify the position of the column in the same way as you would on any other business object.  
    orders.SetVisibleFields( true, orders.FirstName, orders.OrderAmount, orders.OrderDate, orders.OrderProcessed, orders.LastName);  
 
    this.GridView.DataSource = orders.FindAndReturnTable();  
    this.GridView.DataBind();  
}  
 
Using orders As ProcessedOrders = New ProcessedOrders()  
    ' here you can specify search critera or other customizations on the ProcessedOrders view just like you would on any other business object.  
    orders.FirstName.ResultSetName = "First Name" 
    orders.LastName.ResultSetName = "Last Name" 
    orders.OrderProcessed.ResultSetName = "Processed?" 
    orders.OrderDate.ResultSetName = "Date Taken" 
    orders.OrderAmount.ResultSetName = "Total" 
 
    ' you can also hide columns and/or specify the position of the column in the same way as you would on any other business object.  
    orders.SetVisibleFields(True, orders.FirstName, orders.OrderAmount, orders.OrderDate, orders.OrderProcessed, orders.LastName)  
 
    Me.GridView.DataSource = orders.FindAndReturnTable()  
    Me.GridView.DataBind()  
End Using