public bool SqlUpdate()
{
if(id <= 0)
throw new Exception("Item must have an ID assigned by the database!");
string q = "UPDATE `agenda` SET " +
"`color` = '" + (int)color + "', " +
"`description` = '" + description + "', " +
"`startdate` = '" + startdate.Ticks + "', " +
"`duration` = '" + duration.Ticks + "', " +
"`alarm` = '" + Tools.Bool2Int(alarm) + "', " +
"`alarmdate` = '" + alarmdate.Ticks + "', " +
"`recur` = '" + (int)recur + "', " +
"`dayofweek` = '" + startdate.DayOfWeek + "', " +
"`dayofmonth` = '" + startdate.Day + "', " +
"`month` = '" + startdate.Month + "' " +
"WHERE `id` = '" + id + "' LIMIT 1;";
General.DB.ConnectSafe();
int result = General.DB.Update(q);
General.DB.Disconnect();
return (result == 1);
}