Having an issue when adding custom objects onto the Appointment.tag as ExtendedAppointmentInfo. the appointment is saving to the SQL Appointments table, but upon loading the schedule back up the Appointment is not getting serialized and I get no error. How Do I enable exceptions in the serialize of Appointment objects so I can get a clue on what to be looking for. I do have my custom objects decorated as <serializable>.,
Thanks All!
Hi Aaron,
Thank you for contacting Infragistics Developer Support.
You can configure VS to break on all exceptions. In order to do this go to Debug, click Exceptions and then you could select Thrown for an entire category of exceptions, for example, Common Language Runtime Exceptions.
Let me know if you still have issues implementing this.
I don't know what I need to enable to be able to see errors when the winschedule is databinding existing appointments. I do not know why some appointments are not being shown when the dayview is loaded up. I have enabled all Common Language Runtime exceptions and still do not see an error. The appointment does save to the dayview control during runtime, and does persist back to the SQL appointmnents table, but doesn't get loaded back up into the dayview if I exit the test app and come back in. I need to see excepctions why that appointment with the custom properties I have added into the ExtendedAppointmentInfo are not being created.
I am also using the WinScheduleMSSQLServerSupport class from the database sample. Seemed to work before I added the AppointmentStatus and AppointmentLabel custom classes into the extendedappointmnetinfo.
I have removed both custom objects from ExtendedAppointmentInfo and no luck still wont serialize the appointment upon loading. The only way the appointment will load back up from SQL table is if I do not store the Appointment.Tag = info on the SaveAppointment sub. Then and only then I am able to see the appointments load back up and get serialized back into the Dayview. I'm outta ideas here. Its got to be something simple.... Always is.. right?
Ok could it be an issue in the DataAdapterForAppointments? Is the AllProperties column defined correctly ?
Protected Overrides ReadOnly Property DataAdapterForAppointments() As SqlDataAdapter
Get
If Me._sqlDBDataAdapterForAppointments Is Nothing Then
Me._sqlDBDataAdapterForAppointments = New SqlDataAdapter()
' Configure the SELECT command
Dim selectCommandText As String = String.Format(WinScheduleMSSQLServerSupport.SELECT_APPOINTMENTS_TEMPLATE, WinScheduleMSSQLServerSupport.APPOINTMENTS_TABLE_NAME)
Me._sqlDBDataAdapterForAppointments.SelectCommand = New SqlCommand(selectCommandText, Me.Connection)
' Configure the INSERT command
Dim insertCommand As SqlCommand = New SqlCommand()
Dim commandTextTemplate As String = "INSERT INTO {0}(AllProperties, StartDateTime, EndDateTime, Subject, AllDayEvent, OwnerKey) VALUES (@AllProperties, @StartDateTime, @EndDateTime, @Subject, @AllDayEvent, @OwnerKey) SELECT AppointmentID, AllProperties, StartDateTime, EndDateTime, Subject, AllDayEvent, OwnerKey FROM {0} WHERE (AppointmentID = @@IDENTITY)"
insertCommand.CommandText = String.Format(commandTextTemplate, WinScheduleMSSQLServerSupport.APPOINTMENTS_TABLE_NAME)
insertCommand.Connection = Me.Connection
insertCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@AllProperties", System.Data.SqlDbType.VarBinary, 1024, "AllProperties"))
insertCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@StartDateTime", System.Data.SqlDbType.DateTime, 8, "StartDateTime"))
insertCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@EndDateTime", System.Data.SqlDbType.DateTime, 8, "EndDateTime"))
insertCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Subject", System.Data.SqlDbType.VarChar, 50, "Subject"))
insertCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@AllDayEvent", System.Data.SqlDbType.Bit, 1, "AllDayEvent"))
insertCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@OwnerKey", System.Data.SqlDbType.VarChar, 50, "OwnerKey"))
Me._sqlDBDataAdapterForAppointments.InsertCommand = insertCommand
' Configure the UPDATE command
Dim updateCommand As SqlCommand = New SqlCommand()
'Changed this update from = '' to IS NULL for all the AllProperties checks. 7-17-14
commandTextTemplate = "UPDATE {0} SET AllProperties = @AllProperties, StartDateTime = @StartDateTime, EndDateTime = @EndDateTime, Subject = @Subject, AllDayEvent = @AllDayEvent, OwnerKey = @OwnerKey WHERE (AppointmentID = @Original_AppointmentID) AND (AllDayEvent = @Original_AllDayEvent) AND (AllProperties = @Original_AllProperties OR @Original_AllProperties1 IS NULL AND AllProperties IS NULL) AND (EndDateTime = @Original_EndDateTime) AND (OwnerKey = @Original_OwnerKey OR @Original_OwnerKey1 IS NULL AND OwnerKey IS NULL) AND (StartDateTime = @Original_StartDateTime) AND (Subject = @Original_Subject) SELECT AppointmentID, AllProperties, StartDateTime, EndDateTime, Subject, AllDayEvent, OwnerKey FROM {0} WHERE (AppointmentID = @Original_AppointmentID)"
updateCommand.CommandText = String.Format(commandTextTemplate, WinScheduleMSSQLServerSupport.APPOINTMENTS_TABLE_NAME)
updateCommand.Connection = Me.Connection
updateCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@AllProperties", System.Data.SqlDbType.VarBinary, 1024, "AllProperties"))
updateCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@StartDateTime", System.Data.SqlDbType.DateTime, 8, "StartDateTime"))
updateCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@EndDateTime", System.Data.SqlDbType.DateTime, 8, "EndDateTime"))
updateCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Subject", System.Data.SqlDbType.VarChar, 50, "Subject"))
updateCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@AllDayEvent", System.Data.SqlDbType.Bit, 1, "AllDayEvent"))
updateCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@OwnerKey", System.Data.SqlDbType.VarChar, 50, "OwnerKey"))
updateCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_AppointmentID", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "AppointmentID", System.Data.DataRowVersion.Original, Nothing))
updateCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_AllDayEvent", System.Data.SqlDbType.Bit, 1, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "AllDayEvent", System.Data.DataRowVersion.Original, Nothing))
updateCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_AllProperties", System.Data.SqlDbType.VarBinary, 1024, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "AllProperties", System.Data.DataRowVersion.Original, Nothing))
updateCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_AllProperties1", System.Data.SqlDbType.VarBinary, 1024, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "AllProperties", System.Data.DataRowVersion.Original, Nothing))
updateCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_EndDateTime", System.Data.SqlDbType.DateTime, 8, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "EndDateTime", System.Data.DataRowVersion.Original, Nothing))
updateCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_OwnerKey", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "OwnerKey", System.Data.DataRowVersion.Original, Nothing))
updateCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_OwnerKey1", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "OwnerKey", System.Data.DataRowVersion.Original, Nothing))
updateCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_StartDateTime", System.Data.SqlDbType.DateTime, 8, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "StartDateTime", System.Data.DataRowVersion.Original, Nothing))
updateCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_Subject", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "Subject", System.Data.DataRowVersion.Original, Nothing))
updateCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Select_AppointmentID", System.Data.SqlDbType.Int, 4, "AppointmentID"))
Me._sqlDBDataAdapterForAppointments.UpdateCommand = updateCommand
' Configure the DELETE command
Dim deleteCommand As SqlCommand = New SqlCommand()
'CHnaged Delete command from = '' to IS NULL 7-17-14
commandTextTemplate = "DELETE FROM {0} WHERE (AppointmentID = @Original_AppointmentID) AND (AllDayEvent = @Original_AllDayEvent) AND (AllProperties = @Original_AllProperties OR @Original_AllProperties1 IS NULL AND AllProperties IS NULL) AND (EndDateTime = @Original_EndDateTime) AND (OwnerKey = @Original_OwnerKey OR @Original_OwnerKey1 IS NULL AND OwnerKey IS NULL) AND (StartDateTime = @Original_StartDateTime) AND (Subject = @Original_Subject)"
deleteCommand.CommandText = String.Format(commandTextTemplate, WinScheduleMSSQLServerSupport.APPOINTMENTS_TABLE_NAME)
deleteCommand.Connection = Me.Connection
deleteCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_AppointmentID", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "AppointmentID", System.Data.DataRowVersion.Original, Nothing))
deleteCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_AllDayEvent", System.Data.SqlDbType.Bit, 1, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "AllDayEvent", System.Data.DataRowVersion.Original, Nothing))
deleteCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_AllProperties", System.Data.SqlDbType.VarBinary, 1024, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "AllProperties", System.Data.DataRowVersion.Original, Nothing))
deleteCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_AllProperties1", System.Data.SqlDbType.VarBinary, 1024, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "AllProperties", System.Data.DataRowVersion.Original, Nothing))
deleteCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_EndDateTime", System.Data.SqlDbType.DateTime, 8, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "EndDateTime", System.Data.DataRowVersion.Original, Nothing))
deleteCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_OwnerKey", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "OwnerKey", System.Data.DataRowVersion.Original, Nothing))
deleteCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_OwnerKey1", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "OwnerKey", System.Data.DataRowVersion.Original, Nothing))
deleteCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_StartDateTime", System.Data.SqlDbType.DateTime, 8, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "StartDateTime", System.Data.DataRowVersion.Original, Nothing))
deleteCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_Subject", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "Subject", System.Data.DataRowVersion.Original, Nothing))
Me._sqlDBDataAdapterForAppointments.DeleteCommand = deleteCommand
End If
Return Me._sqlDBDataAdapterForAppointments
End Get
End Property
Thank you for the provided code snipped.
What could be the reason for the issue is that the size of the AllProperties field might be too small. I tried using a varbinary(1024) field with ExtendedAppointmentInfo object as the tag and I wasn’t able to save the appointment. After removing the AppointmentStatus and AppointmentLabel properties I was able to save the appointment to the varbinary(1024) field. Then I tested the sample with varbinary(8000), which I was using previously, and everything worked fine.
So please try using a varbinary with bigger size (for example 8000) and try to save the appointment again.
Let me know if this suggestion fixes your issue.
Bingo! Went from varbinary 1024 to varbinary 8000 on the AllProperties field and now all extendedappointmentinfo is saving and serializing fine! Thanks so much for this solution!
Hi Aarron,
I am glad that your issue is resolved. Let me know if you have any additional questions on this matter.
Thank you for using Infragistics components.