public bool SqlInsert()
{
string q = "INSERT INTO `agenda` " +
"(`color`, `description`, `startdate`, `duration`, `alarm`, `alarmdate`, " +
"`recur`, `dayofweek`, `dayofmonth`, `month`) " +
"VALUES " +
"('" + (int)color + "', '" + description + "', '" + startdate.Ticks + "', " +
"'" + duration.Ticks + "', '" + Tools.Bool2Int(alarm) + "', '" + alarmdate.Ticks + "', " +
"'" + (int)recur + "', '" + startdate.DayOfWeek + "', '" + startdate.Day + "', '" + startdate.Month + "');";
General.DB.ConnectSafe();
int result = General.DB.Update(q);
General.DB.Disconnect();
// Query was successful when 1 row was modified
if(result == 1)
{
// Get the ID
id = General.DB.LastInsertID;
return true;
}
else
{
// One row should have been inserted!
return false;
}
}