public override long Insert(object values) { cnn.Open(); ThingsToDo Input = (ThingsToDo)values; cmd.Parameters["$Name"].Value = Input.name; cmd.Parameters["$Status"].Value = Input.status; cmd.Parameters["$lastupdate"].Value = Input.lastUpDate.ToString("yyyy'-'MM'-'dd HH:mm:ss"); cmd.ExecuteNonQuery(); long x = GetLastInsertID(); cnn.Close(); return(x); //Program.manager.InsertTo(); }
public override long Insert(object values) { cnn.Open(); ThingsToDo input = (ThingsToDo)values; cmd.CommandText = "insert into TTD_Stats values($TTDID,$StatName,$Score)"; cmd.Parameters["$TTDID"].Value = input.id; foreach (var x in input.score) { if (x.Value != 0) { cmd.Parameters["$StatName"].Value = x.Key; cmd.Parameters["$Score"].Value = x.Value; cmd.ExecuteNonQuery(); } } cnn.Close(); return(0); }