CalendarView.ExportToDB

From Jeremie Leroy - XOJO Controls Wiki
Jump to: navigation, search
Method
CalendarView.ExportToDB ( DB As Database, TableName As String, ID As String = "ID", StartDate As String = "Start", EndDate As String = "End", Title As String = "Title", EventColor As String = "Color", Location As String = "Location", Description As String = "Description", Recurrence As String = "Recurrence" ) As Boolean


Exports all CalendarEvents to the passed TableName in the passed Database.

This function will return True if there is no error. Check DB.ErrorCode and DB.ErrorMessage if this function returns False.

It will update existing records using the CalendarEvent.ID and create new records if the ID isn't set.


The following SQL code can be used to create a compatible database:

CREATE TABLE IF NOT EXISTS `mydb`.`calendar` (
  `ID` INT NOT NULL AUTO_INCREMENT,
  `startDate` DATETIME NOT NULL,
  `endDate` DATETIME NULL,
  `title` VARCHAR(45) NULL,
  `description` VARCHAR(200) NULL,
  `location` VARCHAR(45) NULL,
  `color` VARCHAR(10) NULL,
  `recurrence` VARCHAR(100) NULL,
  PRIMARY KEY (`ID`))