title: if and else if getting error with method return datatable c#
body: <p>I am getting an error when I write a method returning a datatable using if and else if statement. what is the correct format. Thanks in advance
  "not all code paths return a value"</p>
  
  <pre><code>    [HttpGet]
      public DataTable getcareerdata (int tclass, int efkey)
      {
          if (tclass ==7)
          {
              return obj.GetData(string.Format(@"select Effect_Class_Key , From_Value , To_Value , Effect_Class_Value, Scientific_Degree, case When Scientific_Degree  is null then 'Not Related'
              when Scientific_Degree  = 0 then 'Not Related' when Scientific_Degree  = -1 then 'Not Related' else latin_desc  end as Spec from hr_effect_classes Left Outer Join general_cod 
              on hr_effect_classes.Scientific_Degree = general_cod .sub_cod and  main_cod = 17001  where type_class in (7) and status_class = 1  and effect_key = {0}
              Order By  Scientific_Degree  , From_Value ", efkey));
          }
          else if (tclass == 8)
          {
              return obj.GetData(string.Format(@"select Effect_Class_Key ,  From_Value , To_Value , Effect_Class_Value, Scientific_Degree case When Scientific_Degree is null then 'Not Related'
              when Scientific_Degree  = 0 then 'Not Related' when Scientific_Degree  = -1 then 'Not Related' else L_Desc end as Spec from hr_effect_classes Left Outer Join HR_Specialty   
              on hr_effect_classes.Scientific_Degree = HR_Specialty.Spec_Key where type_class in (8) and status_class = 1 and effect_key = {0}
              Order By  Scientific_Degree  , From_Value ",efkey));
          }
      }
  </code></pre>