Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
180
Using LINQ with CalendarInfo
posted

Has anyone had success in hooking LINQ up with Calendar Info. I tried today and I got the following error:

Buffer cannot be null.

My code looks as follows:

private void BindUltraCalendarInformation(){

 

ProgramsDataContext db = new ProgramsDataContext ();

 

this.ultraCalendarInfo1.DataBindingsForAppointments.SubjectMember = "subject";
this.ultraCalendarInfo1.DataBindingsForAppointments.DescriptionMember = "description";
this.ultraCalendarInfo1.DataBindingsForAppointments.StartDateTimeMember = "start_date_time";
this.ultraCalendarInfo1.DataBindingsForAppointments.EndDateTimeMember = "end_date_time";
this.ultraCalendarInfo1.DataBindingsForAppointments.AllDayEventMember = "all_day_event";

 

 

this.ultraCalendarInfo1.DataBindingsForAppointments.ReminderEnabledMember = "reminder_enabled";

this.ultraCalendarInfo1.DataBindingsForAppointments.ReminderIntervalMember = "reminder_interval" 

this.ultraCalendarInfo1.DataBindingsForAppointments.ReminderUnitsMember = "reminder_units";
this.ultraCalendarInfo1.DataBindingsForAppointments.AllPropertiesMember = "all_properties";
this.ultraCalendarInfo1.DataBindingsForAppointments.DataKeyMember = "data_key" 

this.ultraCalendarInfo1.DataBindingsForAppointments.SetDataBinding(db.Courses.GetNewBindingList(), string.Empty);

}

And I've set the table up as follows 

[course_id] [int]

IDENTITY(1,1) NOT NULL,
[program_id] [int] NOT NULL,
[instructor_id] [int] NULL,
[subject] [nvarchar](250) NOT NULL,
[start_date_time] [datetime] NOT NULL,
[end_date_time] [datetime] NOT NULL,
[description] [text] NULL,
[all_day_event] [bit] NULL,
[reminder_enabled] [bit] NULL,
[reminder_interval] [int] NULL,
[reminder_units] [int] NULL,
[owner_key] [nvarchar](200) NULL,
[recurrence_id] [int] NULL,
[recurrence] [int] NULL,
[original_start_datetime] [datetime] NULL,
[data_key] [nvarchar](300) NULL,
[all_properties] [nvarchar](3000) NULL,

 

Any thoughts or considerations would be helpful.

 

 

Parents
  • 115
    posted

    I've been trying also with some sucess. However, there's a glitch I've not figured out.

    My sql table,SchAppointment,  was designed to reflect the same fields in the Demo Database Scheduler Sample

     

     

     

     

     

     

     

     

     

    [AppointmentId] [int] IDENTITY(1,1) NOT NULL,
    [AllProperties] [varbinary] (2048)  NULL,
    [StartDateTime] [datetime] NOT NULL,
    [EndDateTime] [datetime] NOT NULL,
    [Subject] [varchar](200) NOT NULL,
    [AllDayEvent] [bit] NOT NULL,
    [OwnerKey] [varchar] (50) NULL,
    ===========================

    Next I had to change the dbml's AllProperty field so that is mapped to a byte[].

    Then setup the basic DAL access;

    SchedulerResearch.Data.

    SchDataDataContext mData = new SchedulerResearch.Data.SchDataDataContext(mConnectionString);
    =======================

    Now assign field mappings;

    AppointmentsDataBinding appointmentsDataBinding = this.ultraCalendarInfo1.DataBindingsForAppointments;

    appointmentsDataBinding.AllPropertiesMember =

    "AllProperties";
    appointmentsDataBinding.StartDateTimeMember =
    "StartDateTime";
    appointmentsDataBinding.EndDateTimeMember =
    "EndDateTime";
    appointmentsDataBinding.SubjectMember =
    "Subject";
    appointmentsDataBinding.AllDayEventMember =
    "AllDayEvent";
    appointmentsDataBinding.OwnerKeyMember =
    "OwnerKey";

    ultraCalendarInfo1.DataBindingsForAppointments.DataSource = mData.SchAppointments;

    appointmentsDataBinding.BindingContextControl =

    this;

    =======================

    I also added a button on the control to save data.

    mData.SubmitChanges();

    =======================

    When designing the control I associated the MonthViewSingle control with the CalendarInfo object.

    =======================

    When I first tried to test the control I thought it was not working because I added an appointment then quit and checked the database where there were no new records.

    So I tested again and added two records before quiting. This time the database was populated correctly.

    =======================

    I'm still researching on how to get the scheduler and link to act nice.

    My project use linq and tracks various events to propagate message through the system. I don't want to recreate my DAL support for OLEDb too.

    Any body else having Scheduler to Linq problems????

    Really like to here from you.

Reply Children
No Data