This example shows how you can bind the SchedulerControl to an SQL Server database at runtime. The SqlCommandBuilder is used to generate SQL queries, however you can modify them as required or specify your own queries.
The project uses MS SQL Server database. You can create a new database using the .sql script file included in the project, or use already existing database. Check the code that specifies mappings to ensure that all data fields are correctly mapped to appointment properties.
Note that mappings for the Start and End appointment properties are required. The UniqueID field in the Appointments table is not mapped, however, because it is an identity auto-incremented field updated by MS SQL Sever itself. If you map it for whatever reason, make sure that the CommitIdToDataSource property is set to false.
This project sets the ResourceSharing property to true, so each appointment can be assigned to several resources. The corresponding resource IDs arte stored in XML format in the ResourceIDs field.
If the ResourceSharing property is false (by default), then the AppointmentMappingInfo.ResourceId property should be set to the database field containing the value of the resource ID with which an appointment is associated. Therefore, this field must have the same type as the resource ID. The Scheduler does not restrict the type of resource ID to a particular .NET type, so you can use any data type if the types of the corresponding fields in Appointment and Resource tables will match.
If your database server is not MS SQL, you can replace SqlDataAdapter and SqlCommandBuilder with the corresponding data adapter and command builder, such as OracleDataAdapter and OracleCommandBuilder.
The sample for v2012 vol 2.4 and higher uses MS SQL Server database file included in the project. The database script is attached as the DXDBScheduler.sql file. Instead of System.Windows.Forms.BindingSource instances the SchedulerStorage is bound to the System.Data.Dataset object which provides data for appointments and resources. The dataset is filled by System.Data.SqlClient.SqlDataAdapter instances at runtime.