Navigation bar
  Print document Start Previous page
 70 of 90 
Next page End  

Gravitybox Schedule.NET
1998-2005 Gravitybox Software LLC
Page 68 of 90
In the example below I assume that you have a table name “Engagement” instead of
the standard “Appointment” table. I will also map the field names in the “Engagement”
table to the appropriate fields that the schedule expects.
“Appointment” Table Field
“Engagement” Table Field
Appointment_Guid
Key
Start_Date
Starting
Length
Duration
Subject
Text
The code below assumes that you have loaded a dataset named “MyDataset” with the
“Engagement” table from your database.
Dim MyDataset As DataSet
'Populate the Dataset
'...
'Manually bind the datatable to the AppointmentCollection
schedule1.DataBindings.AppointmentBinding.DataSource = ds.Tables("Engagement")
'Setup the AppointmentBinding object
schedule1.DataBindings.AppointmentBinding.DataFieldBindingCollection.Add("appointment_guid
"Key")
schedule1.DataBindings.AppointmentBinding.DataFieldBindingCollection.Add("start_date",
"Starting")
schedule1.DataBindings.AppointmentBinding.DataFieldBindingCollection.Add("length",
"Duration")
schedule1.DataBindings.AppointmentBinding.DataFieldBindingCollection.Add("subject", "Text"
Schedule1.DataSource = MyDataset
Schedule1.Bind()
There is a binding object for each table to which data can be bound. You may bind up to
eight tables: Appointment, Category, Provider, Room, Resource,
Appointment_Category, Appointment_Provider, and Appointment_Resource. When a
DataTable does not match the standard name, you must set the table binding as shown
above with the “AppointmentBinding” object. There is one for each of the eight tables.
You may map as many or as few fields as you wish so long as you map the required
ones. If a field in your DataTable happens to have the standard name, there is no need
to remap it in the DataBindingCollection object as it will be automatically recognized.
There are a few rules to remember when working with mappings. First, you cannot
create a mapping and add it to more than one collection. You can create a binding and
add it to a DataBindingCollection object or you can specify the binding settings from the
Add method. Also once a DataBinding object has been added to a collection it cannot
be changed. Lastly, only valid fields can be added to the DataBindingCollection object
based on the table to which it maps. For example, you cannot map the room property
“PhoneNumber” to anything since the room has no such property.