Learn when to walk away from a project, and not to get attached to one. If it isn't working, walk away. Your not giving up if you do, because that implies that you didn't learn anything from it, instead treat it as a learning experience from which you are able to apply to future projects.