Luke 18:1 - "One day Jesus told his disciples a story to show that they should always pray and never give up." (NLT)
Never give up. We often hear about failure like it's the worst thing that could ever happen to us, but truthfully, failure can do a lot to build us up. We can use it to motivate ourselves. While failure can sometimes be discouraging, God tells us that there are times to keep trying. We need to keep coming back to Him in prayer when we feel ourselves backsliding. We need to come to Him when we think things are dark and that we'll never achieve our goals.
Just because you try something and it doesn't work out, it doesn't mean the end of the world. It could mean it wasn't the right path for you. It could mean it's just not the right time. It could be that some part of what you tried gave you some skill, knowledge, or idea you needed. God has ways of using our successes and our failures to build us up. We just need to turn to Him and rely on Him, and success will find us, one way or another.