title: Not all code paths return a value in my controller method
body: <p>i am currently doing a Login page which directs to whichever page according to their StaffRole.
  Eg, if StaffRole = Manager, direct to manager page. Here is my code below for my controller method. However my controller method shows an error which says not all code paths return a value. I am unsure how to solve this.</p>
  <pre><code>` [HttpPost]
      public ActionResult Verify(Account acc)
      {
          connectionString();
          con.Open();
          com.Connection = con;
          com.CommandText = &quot;select * from Staff where StaffNRIC='&quot; + acc.StaffNRIC + &quot;' and StaffContact='&quot; + acc.StaffContact + &quot;' and StaffAccountStatus = 'Approved'&quot;;
          dr = com.ExecuteReader();
          if (dr.Read())
          {
              if (dr.HasRows)
              {
                  while (dr.Read())
                  {
                      if (dr[&quot;StaffRole&quot;].ToString() == &quot;Manager&quot;)
                      {
                          dr.Close();
                          return RedirectToAction(&quot;Manager/ManagerHome&quot;, &quot;ManagerController&quot;);//wherever you want to return the user to 
  
                      }
                      else if (dr[&quot;StaffRole&quot;].ToString() == &quot;Admin&quot;)
                      {
                          dr.Close();
                          return RedirectToAction(&quot;Admin/AdminHome&quot;, &quot;AdminController&quot;);
                      }
                      else if (dr[&quot;StaffRole&quot;].ToString() == &quot;Part-Timer&quot;)
                      {
                          dr.Close();
                          return RedirectToAction(&quot;PartTimer/PartTimerHome&quot;, &quot;PartTimerController&quot;);
                      }
                      else
                      {
                          con.Close();
                          return View(&quot;Login&quot;);
                      }
                  }
              }
          }
      }`
  </code></pre>
  <p>'<code> SqlConnection con = new SqlConnection(); SqlCommand com = new SqlCommand(); SqlDataReader dr;</code></p>