ComponentOne Scheduler for ASP.NET: Working with Scheduler for ASP.NET AJAX > Data and Databinding > Using the Built-in Data Storage

Using the Built-in Data Storage

If you do not have an existing database or do not want to bind C1Schedule to a database, you can use the built-in data source provided by C1Schedule. An XML file, named C1ScheduleData.xml by default and specified in the DataFilePath property, is created automatically when a C1Schedule control is added to a form. This file serves as the C1Schedule data storage; data is saved to and loaded from this file.

When C1Schedule is not bound to a database, and users add appointments, contacts, or other information to the schedule at run time, the information is loaded from and saved to the C1ScheduleData.xml file by default. You can also add appointments to the data storage programmatically. For example, the following code, added to the Page_Load event, adds a new appointment to the C1Schedule data storage:

      Visual Basic

' Add a new appointment to the data storage.

Dim app As C1.C1Schedule.Appointment

app = Me.C1Schedule1.DataStorage.AppointmentStorage.Appointments.Add()

 

' Add a subject, location, time frame, and date and start time for the appointment.

app.Subject = "Meeting"

app.Location = "Large Conference Room"

app.Duration = TimeSpan.FromMinutes(45)

app.Start = New Date(2009, 3, 20, 11, 30, 0)

      C#

// Add a new appointment to the data storage.

C1.C1Schedule.Appointment app;

app = this.C1Schedule1.DataStorage.AppointmentStorage.Appointments.Add();

 

// Add a subject, location, time frame, and date and start time for the appointment.

app.Subject = "Meeting";

app.Location = "Large Conference Room";

app.Duration = TimeSpan.FromMinutes(45);

app.Start = new DateTime(2009, 3, 20, 11, 30, 0);


Send comments about this topic to ComponentOne.
Copyright © ComponentOne LLC. All rights reserved.