title: Datareader, not all paths returns a value
body: <p>I want to make a function which returns a string:</p>
  
  <pre><code>public string LienBaseDeConnaissance(string entreprise)
  {
      SqlConnection cnx = new SqlConnection("/* connection string */");
      cnx.Open();
      SqlCommand RequeteExiste = new SqlCommand("sp_SEL_LIEN_BASECONNAISSANCE_EXTRANET_CLIENT", cnx);
      RequeteExiste.CommandType = CommandType.StoredProcedure;
  
      SqlParameter Parameter = RequeteExiste.Parameters.Add("@nom_entreprise", SqlDbType.NVarChar, 15);
      Parameter.Value = entreprise;
  
      string lienBaseConnaissance;
      SqlDataReader _ReaderLines = RequeteExiste.ExecuteReader();
      while (_ReaderLines.Read())
      {
          if (_ReaderLines["ParStrP1"].ToString() != null)
          {
              lienBaseConnaissance = _ReaderLines["ParStrP1"].ToString();
              return lienBaseConnaissance;
          }
          else
          {
              return null;
          }
      }
      cnx.Close();   
  }
  </code></pre>
  
  <p>I select data thanks to a stored procedure and then I would like to return it as a <code>string</code>. The problem is that if I don't put a return after the <code>while ()</code>, all the code doesn't return a value. However I need the variable <code>lienBaseConnaissance</code> which contains the data and out of the <code>while()</code>, the variable in question doesn't have anymore the value I'm looking for.</p>