public static void mergeChanges() { if (authenticated == true) { MySqlDataReader events = Database.executeQuery("SELECT GoogleEventID FROM EVENT WHERE GoogleEventID IS NOT NULL AND StartDateTime > DATETIME('now', 'localtime')"); while (events.Read() == true) { try { EventQuery myQuery = new EventQuery(postUri.ToString() + "/" + events.GetString(0)); lock (threadLock) { EventFeed resultFeed = (EventFeed)service.Query(myQuery); //only update if an event is found if (resultFeed.Entries.Count > 0) { EventEntry calendar = (EventEntry)resultFeed.Entries[0]; Database.modifyDatabase("UPDATE Event SET Title = " + Util.quote(calendar.Title.Text) + ", Description = " + Util.quote(calendar.Content.Content) + ", Location = " + Util.quote(calendar.Locations[0].ValueString) + ", StartDateTime = DATETIME('" + Database.getDateTime(calendar.Times[0].StartTime) + "'), EndDateTime = DATETIME('" + Database.getDateTime(calendar.Times[0].EndTime) + "') WHERE GoogleEventID = '" + events.GetString(0) + "';"); } } } catch (Exception e) { Util.logError("Google Calendar Error: " + e.Message); } } events.Close(); } }