First of all don't get disheartened. Look at the positive aspects too. Your time while pursuing IPCC must not have been a complete waste surely you must have taken up B.com.And things like these happen with many who give their CA. CA is a professional course and unlike BCom etc mere attempting a certain total marks does not gurantee passing as there is something called 'moderation' (nobody knows what it actually implies) and the marking is not as assured as in degree courses (many will vouch for the fact that they could not pass or got very less marks in a paper in which their attempt was best while passed in papers where they never thought they will pass! If in doubt see many posts in CAC on this truth.)SO failing does not make you incompetent. or incapable.
While you resolve the issue of not clearing the IPCC promise yourself that you will clear one group at a time so that by next academic year you will have cleared both the groups.
Take a fresh look at your strategy and mode of preparation. Analyse what and where you are lacking, your weak points (theory or practical/applications), why you could not attempt required questions etc. - then tell yourself what you need to do to rectify those shortcomings. If any one is determined nothing can prove to be barrier for success. So remedy your shortcomings and fill the gap in your current level of achievment and the target - it is not an insurmountable gap. See various IPCC threads where notes, best hints to prepare have been given. Read them and select only the ones you feel applies to you and
meets your requirements. But one thing you must keep in mind prepare from the ICAI material, best books commonly suggested in various forums, RTPs and Suggested answers. Prepare better notes in papers where you have note done well.
Do lot of reading and writing practice, specially covering exam oriented questions - as in CA what is more important is that you write answers which fetch marks not show your knowledge of a topic by writing everything you know on the topic. As soon as you have covered a chapter /section attempt the past and RTP questions in exam oriented manner by timing them. Then compare with suggested /model ansswers and note your deficiencies. Keep a note of your deficiencies to revise before exam. The attempts gone are gone - forget about them, only remember the lessons you have learnt from each attempt.
Once you clear IPCC it hardly matters how many attempts you took (unless it is a first attempt CA) as you have B.Com (which will be an asset in your future career selection) to show for your achievment during the period. Remember there are others like your parents ,good friends who are supporting your efforts so, get set and be on your mark today, don't wait for the result as you will lose precious days that way.
Hope this helps.