CodeImp.Gluon.AgendaItem.SqlUpdate C# (CSharp) Method

SqlUpdate() public method

public SqlUpdate ( ) : bool
return bool
        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);
        }

Usage Example

Esempio n. 1
0
 // This adds an agenda item or updates an existing one
 public bool AddOrUpdateItem(AgendaItem i)
 {
     if(i.id <= 0)
         return i.SqlInsert();
     else
         return i.SqlUpdate();
 }
All Usage Examples Of CodeImp.Gluon.AgendaItem::SqlUpdate