public void CreateTask(Task task)
        {
            createCommand();

            if (task.ID == -1)
            {
                task.ID = GetTaskCount();
            }

            try
            {
                string sql = "INSERT INTO [Task] ([id], [listID], [name], [description], [due], [completed]) VALUES(@id, @listID, @name, @description, @due, @completed)";
                _cmd.CommandText = sql;
                _cmd.Parameters.Add("@id", System.Data.SqlDbType.Int).Value = task.ID;
                _cmd.Parameters.Add("@listID", System.Data.SqlDbType.Int).Value = task.ListID;
                _cmd.Parameters.Add("@name", System.Data.SqlDbType.VarChar).Value = task.Name;
                _cmd.Parameters.Add("@description", System.Data.SqlDbType.VarChar).Value = task.Description;
                _cmd.Parameters.Add("@due", System.Data.SqlDbType.DateTime).Value = task.DueDate;
                _cmd.Parameters.Add("@completed", System.Data.SqlDbType.DateTime);

                if (task.IsCompleted())
                {
                    _cmd.Parameters["@completed"].Value = task.Completed;
                }
                else
                {
                    _cmd.Parameters["@completed"].Value = DBNull.Value;
                }

                _conn.Open();
                _cmd.ExecuteNonQuery();
                _conn.Close();
            }
            catch (SqlException ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
        public void UpdateTask(Task task)
        {
            createCommand();

            string sql = "UPDATE Task SET [name] = @name, [description] = @description, [due] = @due, [completed] = @completed, [listID] = @listID WHERE [id] = @id";

            _cmd.CommandText = sql;
            _cmd.Parameters.Add("@name", System.Data.SqlDbType.VarChar).Value = task.Name;
            _cmd.Parameters.Add("@description", System.Data.SqlDbType.VarChar).Value = task.Description;
            _cmd.Parameters.Add("@due", System.Data.SqlDbType.DateTime).Value = task.DueDate;
            _cmd.Parameters.Add("@completed", System.Data.SqlDbType.DateTime);
            _cmd.Parameters.Add("@listID", System.Data.SqlDbType.Int).Value = task.ListID;
            _cmd.Parameters.Add("@id", System.Data.SqlDbType.Int).Value = task.ID;

            if (task.IsCompleted())
            {
                _cmd.Parameters["@completed"].Value = task.Completed;
            }
            else
            {
                _cmd.Parameters["@completed"].Value = DBNull.Value;
            }

            _conn.Open();
            _cmd.ExecuteNonQuery();
            _conn.Close();
        }