I have implemented a dB with saving in my code but something is wrong

Apr 22, 2008 at 9:38 PM
I have implemented a working save and load dB and functions but it's not working properly. It will sucessfully create the XML and Schema files and write the event "Database Created" and it will load that too. But when I add another event/appointment to the calendar and save it will just write the XML without those events that I just created. So the XML only has the event "Database Created". I can't figure out what I did wrong.

I'm thinking that the appointments or events are not being added to the "scheduleDataset" when they are created, which means they are not being added to the database just to the Calendar.
Can someone look at my code or something and tell me what I have to do to fix this so that new effects will be saved to the dB?

Thanks in advance guys!
-Mike Lierman

Here is my create event code (it draws onto the calendar just fine, but it isn't being added to the database or something):

START CODE BLOCK
private void concrtEvent_Click(object sender, EventArgs e)
{
Appointment m_App = new Appointment();
m_App.StartDate = dayView1.SelectionStart;
m_App.EndDate = dayView1.SelectionEnd;
m_App.BorderColor = Color.Red;

mAppointments.Add(mApp);

dayView1.Invalidate();

writeToXml();
}
END CODE BLOCK

Here is my write to xml functions:

START CODE BLOCK
private void writeToXml()
{
if (File.Exists("dataBase.xml"))
{
File.Delete("dataBase.xml");
File.Delete("stream.xsd");
}
scheduleDataSet.WriteXml("dataBase.xml");
scheduleDataSet.WriteXmlSchema("stream.xsd");
}
END CODE BLOCK

Here is the NewAppointment Event Handler (I created Debug Points here and it didn't seem to be called or used at all, however it should cause I have the add new hander thing in Form1 Load:

START CODE BLOCK
void dayView1_NewAppointment(object sender, NewAppointmentEventArgs args)
{
Appointment m_Appointment = new Appointment();

m_Appointment.StartDate = args.StartDate;
m_Appointment.EndDate = args.EndDate;
m_Appointment.Title = args.Title;
m_Appointment.Group = "2";

mAppointments.Add(mAppointment);

writeToXml();
GetWeek();
}
END CODE BLOCK

Help would be greatly appriated guys cause I don't know how to proceed. The XML files are being saved but the added events in the calendar are not.
Thanks again!

-Mike Lierman