We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to connect the SfSchedule with SQLite?

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,

  1.  Please follow the link as follows,

Link: http://visualstudiogallery.msdn.microsoft.com/1d04f82f-2fe9-4727-a2f9-a2db127ddc9a

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.

http://robtiffany.com/wp-content/uploads/2012/10/4.png

 

  1. It is installed within Visual Studio by selecting Tools | Extensions and Updates.  Expand Online and then search for SQLite.  The same SQLite for Windows Runtime shows up the ability to download and install from within the tool as shown in the following screenshot.  You can be asked to restart Visual Studio after doing this.

  1. SQLite is installed within Visual Studio by selecting Project| Manage NuGet Packages or right-click on References and select Manage NuGet Packages. In the Manage NuGet Packages dialog, expand Online and then search for SQLite.  Your search results include wrappers, but you need to steer in the direction of libraries that supports x86, x64, and ARM without depending on ADO.NET.  Select the LINQ-friendly sqlite-net library created by Frank Krueger, click Install and then close the dialog to add it to your solution. Once the installation is done, SQLiteAsync.cs and SQLite.cs are created in your project.

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 x86x64, 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.

XAML

 

The Custom class’s (ScheduleAppointment) properties created in application are mapped to ScheduleAppointmentMapping class of SfSchedule control.

C#

 

Collection of this Custom class are assigned to Schedule’s ItemsSource property, by listening to the VisibleDates property of the schedule.

C#

 

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.

C#

 

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.

C#

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.

C#

 

The inserted appointments can be retrieved by using queries.

Refer the following code example to retrieve the ScheduleAppointments property.

C#

 

Sample Link

Please find the following sample to illustrate data base connection of SfSchedule.

NewSQLite_Schedule_WinRT.zip

As a result, the stored ScheduleAppointments is retrieved from the SQLite Date base as follows.

Article ID: Published Date: Last Revised Date: Platform: Control:
2549 08/28/2014 08/28/2014 WinRT SfSchedule
Tags:
Did you find this information helpful?
Add Comment
You must log in to leave a comment

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon