title: InvalidCastException: Unable to cast object of type 'System.Int32' to type 'System.String'
body: <p>So I am try to pass some linq data from my controller to my view much like <a href="https://stackoverflow.com/questions/6886143/getting-razor-view-to-understand-linq-to-sql-objects">Getting Razor View to understand Linq to SQL objects</a></p>
  
  <p>but I get an InvalidCastException every time my controller looks like this:</p>
  
  <pre><code>public ActionResult Account()
      {
          return View(data.FailitatorParentLists.ToList());
      }
  </code></pre>
  
  <p>any help would be greatly appreciated!</p>
  
  <pre><code>[InvalidCastException: Unable to cast object of type 'System.Int32' to type 'System.String'.]
  System.Data.SqlClient.SqlBuffer.get_String() +5271065
  System.Data.SqlClient.SqlDataReader.GetString(Int32 i) +75
  Read_FacilitatorParentList(ObjectMaterializer`1 ) +2677
  System.Data.Linq.SqlClient.ObjectReader`2.MoveNext() +32
  System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) +381
  System.Linq.Enumerable.ToList(IEnumerable`1 source) +58
  Omega.Controllers.ParentsController.Account(String returnUrl) in    c:\Users\chrism\Documents\Visual Studio 2012\Projects\Omega\Omega- Source\Omega\Controllers\ParentsController.cs:38
  lambda_method(Closure , ControllerBase , Object[] ) +180
  System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +59
  System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +435
  System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +60
  System.Web.Mvc.Async.AsyncControllerActionInvoker.InvokeSynchronousActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +50
  System.Web.Mvc.Async.&lt;&gt;c__DisplayClass42.&lt;BeginInvokeSynchronousActionMethod&gt;b__41() +75
  System.Web.Mvc.Async.&lt;&gt;c__DisplayClass8`1.&lt;BeginSynchronous&gt;b__7(IAsyncResult _) +44
  System.Web.Mvc.Async.WrappedAsyncResult`1.End() +139
  System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +102
  System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +49
  System.Web.Mvc.Async.&lt;&gt;c__DisplayClass39.&lt;BeginInvokeActionMethodWithFilters&gt;b__33() +126
  System.Web.Mvc.Async.&lt;&gt;c__DisplayClass4f.&lt;InvokeActionMethodFilterAsynchronously&gt;b__49() +323
  System.Web.Mvc.Async.&lt;&gt;c__DisplayClass37.&lt;BeginInvokeActionMethodWithFilters&gt;b__36(IAsyncResult asyncResult) +44
  System.Web.Mvc.Async.WrappedAsyncResult`1.End() +139
  System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +102
  System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +50
  System.Web.Mvc.Async.&lt;&gt;c__DisplayClass2a.&lt;BeginInvokeAction&gt;b__20() +68
  System.Web.Mvc.Async.&lt;&gt;c__DisplayClass25.&lt;BeginInvokeAction&gt;b__22(IAsyncResult asyncResult) +184
  System.Web.Mvc.Async.WrappedAsyncResult`1.End() +136
  System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +56
  System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +40
  System.Web.Mvc.&lt;&gt;c__DisplayClass1d.&lt;BeginExecuteCore&gt;b__18(IAsyncResult asyncResult) +40
  System.Web.Mvc.Async.&lt;&gt;c__DisplayClass4.&lt;MakeVoidDelegate&gt;b__3(IAsyncResult ar) +47
  System.Web.Mvc.Async.WrappedAsyncResult`1.End() +151
  System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +59
  System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +40
  System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +44
  System.Web.Mvc.Async.&lt;&gt;c__DisplayClass4.&lt;MakeVoidDelegate&gt;b__3(IAsyncResult ar) +47
  System.Web.Mvc.Async.WrappedAsyncResult`1.End() +151
  System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +59
  System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +40
  System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +39
  System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +39
  System.Web.Mvc.&lt;&gt;c__DisplayClass8.&lt;BeginProcessRequest&gt;b__3(IAsyncResult asyncResult) +45
  System.Web.Mvc.Async.&lt;&gt;c__DisplayClass4.&lt;MakeVoidDelegate&gt;b__3(IAsyncResult ar) +47
  System.Web.Mvc.Async.WrappedAsyncResult`1.End() +151
  System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +59
  System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +40
  System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +40
  System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +38
  System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9629296
  System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously) +155
  </code></pre>
  
  <p>Here are the Linq to SQL definition Properties</p>
  
  <pre><code>    private System.Nullable&lt;int&gt; _UserID;
  
      private int _StaffLocalID;
  
      private string _Fac;
  
      private string _StaffFirstName;
  
      private string _StaffLastName;
  
      private string _StaffEmail;
  
      private string _AcademyID;
  
      private int _StudentID;
  
      private string _StudentLastName;
  
      private string _StudentFirstName;
  
      private System.Nullable&lt;short&gt; _Grade;
  
      private string _ParentID;
  
      private string _parentemail;
  
      private System.Nullable&lt;int&gt; _ParentUserID;
  
      private string _ParentLastName;
  
      private string _ParentFirstName;
  
      private string _Relationship;
  </code></pre>