I have been reading through the tickets here to see what the best practice to working with the SchedulerControl and a MySQL database. The main issue between the two seems to be the format of the dates. I haven't been able to find any real examples on here on how to get it to work with MySQL, so I am wondering - what is the best method to being that control to a MySQL datasource that allows the inserting of a custom field (a UserID to identify whom to associate the Appointment with)?
Thanks,
Brad
Hi,
I'm afraid we don't have an example of how to bind the SchedulerControl to a MySQL database. If you have any difficulties with this, please explain them in greater detail because now the issue isn't clear to me. For now, I suggest you review the following help article: Data Source Structure. It describes requirements necessary to create a database. I hope it will be useful for you. I am looking forward to your response.
I was trying to accomplish this using ADO NET, but for some reason, it just didn't want to work correctly. I ended up just binding my appointment table through a DataSet (using the MS SQL tutorial) as a template.
For those that are trying to do the same thing, I suggest just following this tutorial for MS SQL here (even if you are using MySQL):
http://documentation.devexpress.com/#WindowsForms/CustomDocument2278
There is one VERY IMPORTANT thing to do differently, and that is on the OnAppointmentChangedInsertedDeleted event:
After updating your TableAdapter with your dataset, you MUST fill that TableAdapter or you will get a concurrency error after adding a new appointment::
tblappointmentTableAdapter.Update(apptDataSet);
// Refresh the TableAdapter to avoid concurrency error
this.tblappointmentTableAdapter.Fill(this.apptDataSet.tblappointment);
apptDataSet.AcceptChanges();
For those that are wanting to associate an appointment with a specific user, simply add a UserID field to your appointment table, and then on the schedulerStorage1_AppointInserting event, you can do this:
// Set the UserID to associate with Appointment
Appointment apt = ((Appointment)e.Object);
apt.CustomFields["UserID"] = _userID;
Hopefully this help save others a bit of time in researching how to get rid of the Concurrency issue as well as working with a custom field.
Thank you for sharing useful information with us! We greatly appreciate your efforts! This information will be very useful for other customers who may encounter a similar issue. Please feel free to contact us if you have any further difficulties.