locked
Allowing code to carry on if conditions are not met RRS feed

  • Question

  • User-2112901542 posted

    Hi All,

    Doing some code maintainence and I am not sure why the code break at this point:

    ==>BKSBSQLHelper bsh = new BKSBSQLHelper();<==

    but what can I add to the code to allow it to carry on

    if (Config.BKSB_PB() && repeatBksb == 0)
                        {
                            UserAssociationRepository uar = new UserAssociationRepository(em, SessionHelper.GetDatasetID(Session));
                            UserAssociation uas = uar.GetEarliestEnrolment(Model.id);
                            if (uas != null)
                            {
                                repeatBksb = 1;
                                BksbRepository br = new BksbRepository(em);
                                BKSBSQLHelper bsh = new BKSBSQLHelper();
                                if (br.CheckBLForStudent(Model.id, "Mathematics"))
                                {   


    if the conditions are not met?

    Thanks

    Wednesday, November 14, 2012 8:55 AM

Answers

  • User1957004874 posted

    It depends what line it is breaking, you need ot keep around that.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, November 14, 2012 11:06 AM

All replies

  • User1957004874 posted

    Add a try catch block and ignore the error, if you don't need it or log it and continue.

    Wednesday, November 14, 2012 9:42 AM
  • User-2112901542 posted
     if (Config.BKSB_PB() && repeatBksb == 0)
                        {
                            UserAssociationRepository uar = new UserAssociationRepository(em, SessionHelper.GetDatasetID(Session));
                            UserAssociation uas = uar.GetEarliestEnrolment(Model.id);
                            if (uas != null)
    							try				
                            {
                                repeatBksb = 1;
                                BksbRepository br = new BksbRepository(em);
    							BKSBSQLHelper bsh = new BKSBSQLHelper();
    							catch(ThreadAbortException)
    							{
                                throw;
    							}
    

    would it be like this,

    Wednesday, November 14, 2012 10:34 AM
  • User1957004874 posted

    It depends what line it is breaking, you need ot keep around that.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, November 14, 2012 11:06 AM