Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Error saving appointment after changing HeaderColour. (Read 5908 times)
TRB
Junior Member
**
Offline


Meppy knows all!!

Posts: 80
Location: Australia
Joined: Jun 7th, 2013
Error saving appointment after changing HeaderColour.
Jun 9th, 2013 at 2:36pm
Print Post  
Hi, I am having trouble saving appointments on which I have changed the header colour/color. I am using an SQL Server database to store my data and am writing in VB.Net.

The error I get is "The delete statement conflicts with the Reference constraint " Item_FK03". The conflict occurred in database "MySQL_Database", table"dbo.item", column 'Style'.

I believe the error occurs due to there being no item in the Style Table to match the change colour in the header.? My question is, how can I change the header colour based on the resource assigned to that resource and the save the item?

Is there another way of doing this like assign a style to a specific resource so every time that resource is assigned to an appointment it is automatically said colour.

Thanks in advance,
Tim.
  

Regards,
TRB
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Error saving appointment after changing HeaderColour.
Reply #1 - Jun 10th, 2013 at 7:29am
Print Post  
Hi,

Can you provide more information about your item and style tables and the relationship between them?

Regarding your question - it is not possible to style an item based on its resource association automatically. If it was possible it would be difficult to pick the resource to use for styling because items can be associated with many resources at a time. You can still do this manually, by assigning the appropriate properties of the item's Style when the item is associated with a specific resource.

Regards,
Meppy
  
Back to top
 
IP Logged
 
TRB
Junior Member
**
Offline


Meppy knows all!!

Posts: 80
Location: Australia
Joined: Jun 7th, 2013
Re: Error saving appointment after changing HeaderColour.
Reply #2 - Jun 10th, 2013 at 9:22am
Print Post  
Thanks for the reply Meppy. Have read a number of your posts and your knowladge of not only this control but programming in general is unbelievable!!

Anyway....
These two tables are set up with the same fields as the standard "planner" database with a few additional fields for information i require. the relationship is from Parent table "Style"/"Key" to Child Table "Item"/"Style" set to "Relation Only"..No consttraints or Rules.


Is that the information you were requesting.

  

Regards,
TRB
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Error saving appointment after changing HeaderColour.
Reply #3 - Jun 10th, 2013 at 12:51pm
Print Post  
Hi,

Can you also provide me with the stack trace of the exception? Also, does the error happen only when you modify the header brush of the item?

Regards,
Meppy
  
Back to top
 
IP Logged
 
TRB
Junior Member
**
Offline


Meppy knows all!!

Posts: 80
Location: Australia
Joined: Jun 7th, 2013
Re: Error saving appointment after changing HeaderColour.
Reply #4 - Jun 10th, 2013 at 12:55pm
Print Post  
I have discovered it is not only when I change the colour of the header. It when I create an appointment via the form I have created. When creating an Appointment via code, do I have to specify a style?
  

Regards,
TRB
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Error saving appointment after changing HeaderColour.
Reply #5 - Jun 10th, 2013 at 1:25pm
Print Post  
Hi,

You don't need to specify styles for items. When an item is created it is automatically initialized with four styles that can be accessed through its Style, SelectedStyle, PointedStyle and PointedSelectedStyle properties. These styles are initially blank and accessing any of their properties will return a value, which depends on the current theme. To modify the appearance of the item, you can assign the properties of these styles directly.

Even if you do not modify any of the styles however, they will still be stored in the database when the entire schedule is saved.

Regards,
Meppy
  
Back to top
 
IP Logged
 
TRB
Junior Member
**
Offline


Meppy knows all!!

Posts: 80
Location: Australia
Joined: Jun 7th, 2013
Re: Error saving appointment after changing HeaderColour.
Reply #6 - Jun 10th, 2013 at 2:08pm
Print Post  
Here is the Stack Trace...

System.Data.SqlClient.SqlException
Message=The DELETE statement conflicted with the REFERENCE constraint "Item_FK03". The conflict occurred in database "DashboardPlannerSQL1", table "dbo.Item", column 'Style'.
The statement has been terminated.
Source=.Net SqlClient Data Provider
StackTrace:
   at System.Data.Common.DbDataAdapter.UpdatedRowStatusErrors(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
   at System.Data.Common.DbDataAdapter.UpdatedRowStatus(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
   at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping)
   at System.Data.Common.DbDataAdapter.UpdateFromDataTable(DataTable dataTable, DataTableMapping tableMapping)
   at System.Data.Common.DbDataAdapter.Update(DataSet dataSet, String srcTable)
   at System.Data.Common.DbDataAdapter.Update(DataSet dataSet)
   at MindFusion.Scheduling.DataBinding.x8db18c2080b4ae64.x836093ae8ca8dd2e(Boolean xd441e330aca0adbe)
   at MindFusion.Scheduling.DataBinding.xa7e178e5abda1bf4.x3967b919ae7ea836(Boolean xd441e330aca0adbe)
   at MindFusion.Scheduling.WinForms.Calendar.SaveToDataSource(Component reminderTableAdapter, Component styleTableAdapter, Component customBrushesTableAdapter, Component contactTableAdapter, Component locationTableAdapter, Component resourceTableAdapter, Component taskTableAdapter, Component itemTableAdapter, Component itemContactsTableAdapter, Component itemResourcesTableAdapter, Component recurrenceTableAdapter, Component recurrenceExceptionTableAdapter, Component recurrenceExceptionsTableAdapter)
   at WindowsApplication1.frmDashboard.SaveToolStripButton_Click(Object sender, EventArgs e) in C:\Users\valued customer\Documents\Visual Studio 2012\Projects\ProjectDashboard\ProjectDashboard\Dashboard.vb:line 98Int32 UpdatedRowStatusErrors(System.Data.Common.RowUpdatedEventArgs, BatchCommandInfo[], Int32)
InnerException:
  

Regards,
TRB
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Error saving appointment after changing HeaderColour.
Reply #7 - Jun 11th, 2013 at 8:21am
Print Post  
Hi,

I'm having difficulties figuring out why this is happening. When the calendar saves the schedule to the database it first clears the existing data. It appears that when this clear is performed on the items table the error happens because of a reference constraint to the styles table. While there indeed is a reference between the two tables, having styles in the styles table referenced by items in the items table should not be an obstacle for the items to be deleted. What would happen if you try to manually delete an item from the items table while there is a related record in the styles table?

Regards,
Meppy
  
Back to top
 
IP Logged
 
TRB
Junior Member
**
Offline


Meppy knows all!!

Posts: 80
Location: Australia
Joined: Jun 7th, 2013
Re: Error saving appointment after changing HeaderColour.
Reply #8 - Jun 29th, 2013 at 12:25pm
Print Post  
Hi Meppy,
I have it working. I created my database from scratch and it works fine now. I still can not see the slightest difference between the two databases but the new one works!!

Thanks for your assistance.
  

Regards,
TRB
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint