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. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to bind the SQL data with WinForms ScheduleControl?

Platform: WinForms |
Control: ScheduleControl
Tags: databinding

Bind SQL data with Schedule

By default, the ScheduleControl does not have the direct support to bind data from SQL server. To get direct support to bind data from SQL server, the schedule control should be bound with ScheduleDataProvider data source, and the appointments should be processed using the ScheduleAppointment. So, generate the ScheduleAppointment manually based on the retrieved data from SQL database.


SimpleScheduleDataProvider dataProvider = new SimpleScheduleDataProvider();
SimpleScheduleAppointmentList list = new SimpleScheduleAppointmentList();
dataProvider.MasterList = list;
scheduleControl1.DataSource = dataProvider;
SqlConnection con = new SqlConnection(ConnectionString);
string sql = "select * from ScheduleData";
SqlCommand cmd = new SqlCommand(sql, con);
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
    ScheduleAppointment item = new ScheduleAppointment();
    item.UniqueID = (int)dr["UniqueID"];
    item.Subject = (string)dr["Sub"];
    item.StartTime = (DateTime)dr["StartTime"];
    item.ReminderValue = (int)dr["ReminderValue"];
    item.Reminder = false;
    item.Owner = (int)dr["Own"];
    item.MarkerValue = (int)dr["MarkerValue"];
    item.LocationValue = (string)dr["LocationValue"];
    item.LabelValue = 0;
    item.EndTime = (DateTime)dr["EndDate"];
    item.Content = (string)dr["Content"];
    item.AllDay = false;
     item.Dirty = false;



To work with SQL data at client machine, modify the connection string by creating a data base using the SQL Express, and then add the table “ScheduleData” like the attached local database file in sample.

Sample: SQL database to ScheduleControl

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

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

Live Chat Icon For mobile