SfSchedule is connected with the database in order to store the appointments. To achieve this, you need to install the SQLite’s in your project. This article explains the storing of SfSchedule appointments in SQLite’s database.
Adding SQLite in project
To store Schedule appointments in SQL Server Compact, SQLite’s characteristics are used. It’s an embedded database that runs in-process with your app instead of running as a separate process like a server-based database. It stores data in a single disk file, supports transactions, and doesn’t require any type of configuration to get started.
The following are three ways to install SQLite,
When the download process is completed, install the sqlite-winrt81-3080301.vsix.This launches the VSIX Installer as shown in the following screenshot. Click Install.
After the SQLite for Window Runtime is installed, launch Visual Studio 2013 on your Windows 8.1computer and create new Windows Store app. In the Solution Explorer, right-click on References, and select Add Reference. In the Reference Manager, expand Windows and select Extensions on the left side of the dialog. Check both Microsoft Visual C++ Runtime Package and SQLite for Windows Runtime and click OK as shown as follows.
In order to create an app using SQLite, you cannot use any CPU compilation. Therefore, from the Debug combo box, select Configuration Manager. For both Debug and Release Active solution configurations, you can select either x86, x64, or ARM for your Active solution platform. You must switch to Release before submitting your app to the store.
To Connect SfSchedule with SQLite Database
Create WinRT application and add SfSchedule control as follows.
The Custom class’s (ScheduleAppointment) properties created in application are mapped to ScheduleAppointmentMapping class of SfSchedule control.
Collection of this Custom class are assigned to Schedule’s ItemsSource property, by listening to the VisibleDates property of the schedule.
Note: In the above code example, appointments are filtered based on the current visible date and assigned to the schedule, in order to avoid handling of large collection of data to improve performance.
VisibleDates property of the Schedule control is binded with the local property, to listen and handle appointment based on the visible date change in schedule.
Refer the following code example.
In order to store the schedule appointments in SQLite database, you can create table when it does not exist, to store the appointments of SfSchedule in App.Xaml.cs. Use SQLiteConnection class to connect ScheduleAppointments with SQLite database.
Refer the following code example to create the table in SQLite Database.
You can insert the appointments after the table is created. Similarly you can update, and delete the appointments of Schedule that is stored in database.
Refer the following code example to insert the ScheduleAppointments in SQLite database.
The inserted appointments can be retrieved by using queries.
Refer the following code example to retrieve the ScheduleAppointments property.
Please find the following sample to illustrate data base connection of SfSchedule.
|Article ID:||Published Date:||Last Revised Date:||Platform:||Control:|