Coder Social home page Coder Social logo

devexpress-examples / how-to-bind-schedulercontrol-to-ms-sql-server-database-at-runtime-e551 Goto Github PK

View Code? Open in Web Editor NEW
4.0 57.0 1.0 436 KB

Bind the Scheduler control to MS SQL Server.

License: Other

C# 41.02% TSQL 16.78% Visual Basic .NET 42.20%
dotnet xtrascheduler-suite data-binding scheduler sql-server windows-forms winforms

how-to-bind-schedulercontrol-to-ms-sql-server-database-at-runtime-e551's Introduction

WinForms Scheduler - Bind to MS SQL Server (runtime)

This example shows how to bind the SchedulerControl to a MS SQL Server database at runtime. The SqlCommandBuilder class is used to generate SQL queries.

The example uses the MS SQL Server database. You can create a new database using the .sql script file included in the project, or connect to another database. Check the code that specifies mappings to ensure that all data fields are correctly mapped to appointment properties.

In this example:

  • Define mappings.

    The UniqueID field in the Appointments table is not mapped because it is an identity auto-incremented field updated by MS SQL Sever. If you map it, make sure that the AppointmentStorage.CommitIdToDataSource option is disabled.

    private void MapAppointmentData() {
        this.schedulerDataStorage1.Appointments.Mappings.AllDay = "AllDay";
        this.schedulerDataStorage1.Appointments.Mappings.Description = "Description";
        // Required mapping.
        this.schedulerDataStorage1.Appointments.Mappings.End = "EndDate";
        this.schedulerDataStorage1.Appointments.Mappings.Label = "Label";
        this.schedulerDataStorage1.Appointments.Mappings.Location = "Location";
        this.schedulerDataStorage1.Appointments.Mappings.RecurrenceInfo = "RecurrenceInfo";
        this.schedulerDataStorage1.Appointments.Mappings.ReminderInfo = "ReminderInfo";
        // Required mapping.
        this.schedulerDataStorage1.Appointments.Mappings.Start = "StartDate";
        this.schedulerDataStorage1.Appointments.Mappings.Status = "Status";
        this.schedulerDataStorage1.Appointments.Mappings.Subject = "Subject";
        this.schedulerDataStorage1.Appointments.Mappings.Type = "Type";
        this.schedulerDataStorage1.Appointments.Mappings.ResourceId = "ResourceIDs";
        this.schedulerDataStorage1.Appointments.CustomFieldMappings.Add(new AppointmentCustomFieldMapping("MyNote", "CustomField1"));
    }
  • Set the ResourceSharing property to true to assign multiple resources to appointments.

    this.schedulerDataStorage1.Appointments.ResourceSharing = true;

    If the ResourceSharing property is set to false (the default value), the AppointmentMappingInfo.ResourceId property should be set to the database field that contains the value of the resource ID that is associated with the appointment. This field must contain values of the same type as the resource ID. The Scheduler control does not restrict the type of resource ID to a particular .NET type. You can use any data type if the types of corresponding fields in Appointment and Resource data tables match.

If your database server is not MS SQL, you can replace SqlDataAdapter and SqlCommandBuilder with another data adapter and command builder (for example, OracleDataAdapter and OracleCommandBuilder).

Documentation

how-to-bind-schedulercontrol-to-ms-sql-server-database-at-runtime-e551's People

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

lexepox

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.