St James in his Epistle says we are blessed when we endure temptation, but the question is "How do we resist temptation?" Here are some thoughts that might be useful:
We need to know what it is that tempts us to sin, and remember that its a natural human failing.
Try to avoid putting yourself in a situation where you're going to be tempted - and run away when you are!
Repent, when you cannot resist temptation.
Ask God's help when faced with temptation.
Pick yourself up after a failure and move on positively.