title: LinQ how to change a integer like 1 to string 001
body: <p>I have a table in my database with four columns:</p>
  
  <pre><code>string: year
  string: weeknr
  int:    number
  </code></pre>
  
  <p>In other tables I combine these columns into <code>yywwnnn</code> as a string.</p>
  
  <p>The number columns is a identity column.</p>
  
  <p>Now I want to retrieve some records from a table that I want to join with the mentioned table.</p>
  
  <p>something like:</p>
  
  <pre><code>from R in db.Requests
  join RN in db.RequestNumbers on R.RequestNumber equals (RN.Year + RN.Weeknr + RN.Number)
  </code></pre>
  
  <p>But of course RN.Number is a integer and I need it to be a 3 digit string.</p>
  
  <p>so:<br>
      16 07 1   ==> 1607001<br>
      16 07 10  ==> 1607010<br>
      16 07 100 ==> 1607100</p>
  
  <p>I have tried this:</p>
  
  <pre><code>from R in db.Requests
  join RN in db.RequestNumbers on R.RequestNumber equals (RN.Year + RN.Weeknr + (RN.Number.toString().PadLeft(3,char.Parse("0")))
  </code></pre>
  
  <p>But PadLeft is not recognized.<br>
  Is there any other solution to this?</p>
  
  <p>[EDIT]
  This is the full method:</p>
  
  <pre><code>public List&lt;RequestList&gt; getMyRequests(string userID)
  {
    var result = (from R in db.Requests
                  join MT in db.MainTorsList on R.Category equals MT.MainTorsListID into MTL
                  from MT in MTL.DefaultIfEmpty()
                  join ST in db.SubTorsList on R.RequestType equals ST.SubTorsListID into STL
                  from ST in STL.DefaultIfEmpty()
                  join S in db.StatusList on R.RequestStatus equals S.StatusListID into SL
                  from S in SL.DefaultIfEmpty()
                  join RN in db.RequestNumber on R.RequestNumber equals RN.Year + RN.Week + (RN.Number.ToString().PadLeft(3, char.Parse("0"))) into RNL
                  from RN in RNL.DefaultIfEmpty()
                  where R.CreatedBy == userID &amp;&amp; RN.Removed == false
  
                  select new
                  {
                    RequestID = R.RequestID,
                    RequestDate = R.CreatedOn,
                    RequestNumber = R.RequestNumber,
                    Category = MT.Name,
                    RequestType = ST.Name,
                    Description = R.RequestDescription,
                    Status = S.Name,
                    Options = ""
                  }
                  );
  
    List&lt;RequestList&gt; requests = (List&lt;RequestList&gt;)result.ToList().ToNonAnonymousList(typeof(RequestList));
  
    return requests;
  }
  </code></pre>
  
  <p>The error message:</p>
  
  <pre><code>Additional information: LINQ to Entities does not recognize the method 'System.String PadLeft(Int32, Char)' method, and this method cannot be translated into a store expression.
  </code></pre>