Difference between revisions of "CalendarView.ExportToDB"

From Jeremie Leroy - XOJO Controls Wiki
Jump to: navigation, search
Line 19: Line 19:
 
It will update existing records using the [[CalendarEvent.ID]] and
 
It will update existing records using the [[CalendarEvent.ID]] and
 
create new records if the ID isn't set.
 
create new records if the ID isn't set.
 +
 +
 +
The following SQL code can be used to create a compatible database:
 +
<source lang="sql">
 +
CREATE TABLE IF NOT EXISTS `mydb`.`calendar` (
 +
  `ID` INT NOT NULL AUTO_INCREMENT,
 +
  `start` DATETIME NOT NULL,
 +
  `end` 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`))
 +
</source>

Revision as of 23:49, 16 September 2015

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,
  `start` DATETIME NOT NULL,
  `end` 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`))