title: Specified cast is not valid when getting Datatable Column Value
body: <p>The above error message appears when I am trying to get Column Value from Datatable.</p>
  
  <p>This is what I find in the stacktrace:</p>
  
  <blockquote>
    <p>System.Linq.Enumerable.WhereSelectEnumerableIterator<code>2.MoveNext()<br>
    at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable</code>1
    source)</p>
  </blockquote>
  
  <pre><code> and this in the TargetSite when debugging:
  </code></pre>
  
  <blockquote>
    <p>{ Boolean b__0(System.Data.DataRow)}</p>
  </blockquote>
  
  <p>Here is my code:
                  DataTable hr = new DataTable();</p>
  
  <pre><code>            hr.Columns.Add("BookingDate");
              hr.Columns.Add("BookingId");
              hr.Columns.Add("BookingSource");
              hr.Columns.Add("CheckInDate");
              hr.Columns.Add("CheckOutDate");
  
  
              for (int i = 0; i &lt; gmisc.GetModifiedBookings(gmoreq).Bookings.Length; i++)
              {
                  hr.Rows.Add();
                  hr.Rows[i]["BookingDate"] = Convert.ToDateTime(gmisc.GetModifiedBookings(gmoreq).Bookings[i].BookingDate.ToString());
                  hr.Rows[i]["BookingId"] = Convert.ToInt64(gmisc.GetModifiedBookings(gmoreq).Bookings[i].BookingId.ToString());
                  hr.Rows[i]["BookingSource"] = gmisc.GetModifiedBookings(gmoreq).Bookings[i].BookingSource.ToString();
                  hr.Rows[i]["CheckInDate"] = Convert.ToDateTime(gmisc.GetModifiedBookings(gmoreq).Bookings[i].CheckInDate.ToString());
                  hr.Rows[i]["CheckOutDate"] = Convert.ToDateTime(gmisc.GetModifiedBookings(gmoreq).Bookings[i].CheckOutDate.ToString());
  
  
  
              }
              Int64 BookingId = (from DataRow dr in hr.Rows
                            where (Int64)dr["BookingId"] == BookId
                            select (Int64)dr["BookingId"]).FirstOrDefault();
                  TextBox1.Text = Convert.ToString(BookingId);
  </code></pre>
  
  <p>Where did I go wrong, if somebody can please tell me.</p>