title: LINQ to Entities does not recognize the method 'System.String StringConvert(System.Nullable`1[System.Double])
body: <p>I can't figure out why I'm getting this error. I have used this function successfully with previous versions of Entity Framework but I've set up a new project using EF6 and it's not cooperating. </p>
  
  <pre><code>using System.Data;
  using System.Data.Objects.SqlClient;
  
  e.Result = from n in MyDB.tblBulletins
       where n.AnncStart &lt;= DateTime.Now &amp;&amp; n.AnncEnd &gt; DateTime.Now &amp;&amp; n.Approved == true
       orderby n.AnncStart descending, n.AnncDate descending
       select new
       {
          n.RecID,
          AnncTitle = n.AnncTitle + " &lt;a href='bulletinAdd.aspx?ID=" + SqlFunctions.StringConvert((double)n.RecID).Trim() + "'&gt;&lt;Edit&gt;&lt;/a&gt;",
          AnncText = (n.AnncImg == null ? n.AnncText : "&lt;a href='images/bulletin/" + n.AnncImg + "'&gt;&lt;img src='images/bulletin/" + n.AnncImg + "' class='stickyphoto' alt='Click for larger image'/&gt;&lt;/a&gt;" + n.AnncText),
          Email = (n.Email == null ? "" : "&lt;br/&gt;&lt;a href='mailto:" + n.Email + "'&gt;" + n.Email + "&lt;/a&gt;"),
          n.AnncType,
          n.AnncDate,
          n.AnncEnd,
          n.v_EmpBasicInfo.Name
        };
  </code></pre>
  
  <p>When I run this I get
  <em>LINQ to Entities does not recognize the method 'System.String StringConvert(System.Nullable`1[System.Double])' method, and this method cannot be translated into a store expression.</em> </p>
  
  <p>n.RecID is an int primary key on the table in a SQL database (SQL Server Standard Edition)</p>
  
  <p>All I can seem to find through searches is people recommending StringConvert instead of ToString</p>
  
  <p>ADDITION - Stack Trace:</p>
  
  <pre><code>[NotSupportedException: LINQ to Entities does not recognize the method 'System.String StringConvert(System.Nullable`1[System.Double])' method, and this method cannot be translated into a store expression.]
  System.Data.Entity.Core.Objects.ELinq.DefaultTranslator.Translate(ExpressionConverter parent, MethodCallExpression call) +194
  System.Data.Entity.Core.Objects.ELinq.MethodCallTranslator.TypedTranslate(ExpressionConverter parent, MethodCallExpression linq) +976
  System.Data.Entity.Core.Objects.ELinq.TypedTranslator`1.Translate(ExpressionConverter parent, Expression linq) +88
  System.Data.Entity.Core.Objects.ELinq.ExpressionConverter.TranslateExpression(Expression linq) +148
  System.Data.Entity.Core.Objects.ELinq.BinaryTranslator.TypedTranslate(ExpressionConverter parent, BinaryExpression linq) +122
  System.Data.Entity.Core.Objects.ELinq.TypedTranslator`1.Translate(ExpressionConverter parent, Expression linq) +88
  System.Data.Entity.Core.Objects.ELinq.ExpressionConverter.TranslateExpression(Expression linq) +148
  System.Data.Entity.Core.Objects.ELinq.BinaryTranslator.TypedTranslate(ExpressionConverter parent, BinaryExpression linq) +87
  System.Data.Entity.Core.Objects.ELinq.TypedTranslator`1.Translate(ExpressionConverter parent, Expression linq) +88
  System.Data.Entity.Core.Objects.ELinq.ExpressionConverter.TranslateExpression(Expression linq) +148
  System.Data.Entity.Core.Objects.ELinq.NewTranslator.TypedTranslate(ExpressionConverter parent, NewExpression linq) +520
  System.Data.Entity.Core.Objects.ELinq.TypedTranslator`1.Translate(ExpressionConverter parent, Expression linq) +88
  System.Data.Entity.Core.Objects.ELinq.ExpressionConverter.TranslateExpression(Expression linq) +148
  System.Data.Entity.Core.Objects.ELinq.ExpressionConverter.TranslateLambda(LambdaExpression lambda, DbExpression input) +168
  System.Data.Entity.Core.Objects.ELinq.ExpressionConverter.TranslateLambda(LambdaExpression lambda, DbExpression input, DbExpressionBinding&amp; binding) +160
  System.Data.Entity.Core.Objects.ELinq.OneLambdaTranslator.Translate(ExpressionConverter parent, MethodCallExpression call, DbExpression&amp; source, DbExpressionBinding&amp; sourceBinding, DbExpression&amp; lambda) +168
  System.Data.Entity.Core.Objects.ELinq.SelectTranslator.Translate(ExpressionConverter parent, MethodCallExpression call) +70
  System.Data.Entity.Core.Objects.ELinq.SequenceMethodTranslator.Translate(ExpressionConverter parent, MethodCallExpression call, SequenceMethod sequenceMethod) +47
  System.Data.Entity.Core.Objects.ELinq.MethodCallTranslator.TypedTranslate(ExpressionConverter parent, MethodCallExpression linq) +141
  System.Data.Entity.Core.Objects.ELinq.TypedTranslator`1.Translate(ExpressionConverter parent, Expression linq) +88
  System.Data.Entity.Core.Objects.ELinq.ExpressionConverter.TranslateExpression(Expression linq) +148
  System.Data.Entity.Core.Objects.ELinq.ExpressionConverter.Convert() +50
  System.Data.Entity.Core.Objects.ELinq.ELinqQueryState.GetExecutionPlan(Nullable`1 forMergeOption) +563
  System.Data.Entity.Core.Objects.&lt;&gt;c__DisplayClassb.&lt;GetResults&gt;b__a() +83
  System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction(Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess) +499
  System.Data.Entity.Core.Objects.&lt;&gt;c__DisplayClassb.&lt;GetResults&gt;b__9() +271
  System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute(Func`1 operation) +251
  System.Data.Entity.Core.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption) +600
     System.Data.Entity.Core.Objects.ObjectQuery`1.&lt;System.Collections.Generic.IEnumerable&lt;T&gt;.GetEnumerator&gt;b__0() +89
  System.Lazy`1.CreateValue() +416
  System.Lazy`1.LazyInitValue() +152
  System.Lazy`1.get_Value() +75
  System.Data.Entity.Internal.LazyEnumerator`1.MoveNext() +40
  System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) +381
  System.Linq.Enumerable.ToList(IEnumerable`1 source) +58
  
  [TargetInvocationException: Exception has been thrown by the target of an invocation.]
  System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
  System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +92
  System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +108
  System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) +19
  System.Web.UI.WebControls.QueryableDataSourceHelper.ToList(IQueryable query, Type dataObjectType) +225
  System.Web.UI.WebControls.LinqDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +549
  System.Web.UI.WebControls.Repeater.GetData() +55
  System.Web.UI.WebControls.Repeater.CreateControlHierarchy(Boolean useDataSource) +89
  System.Web.UI.WebControls.Repeater.OnDataBinding(EventArgs e) +61
  System.Web.UI.WebControls.Repeater.DataBind() +105
  System.Web.UI.WebControls.Repeater.EnsureDataBound() +49
  System.Web.UI.WebControls.Repeater.OnPreRender(EventArgs e) +15
  System.Web.UI.Control.PreRenderRecursiveInternal() +83
  System.Web.UI.Control.PreRenderRecursiveInternal() +168
  System.Web.UI.Control.PreRenderRecursiveInternal() +168
  System.Web.UI.Control.PreRenderRecursiveInternal() +168
  System.Web.UI.Control.PreRenderRecursiveInternal() +168
  System.Web.UI.Control.PreRenderRecursiveInternal() +168
  System.Web.UI.Control.PreRenderRecursiveInternal() +168
  System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +974
  </code></pre>