title: Unable to cast object of type 'System.Data.Linq.DataQuery`1[System.Int32]' to type 'System.IConvertible'
body: <p>I'm trying to insert the data into my database which has 2 tables</p>
  
  <p>Products<br>
  (ProductID): 1<br>
  (IDNumber) : 200900110<br>
  (ProductName) :  Pepsi<br>
  <br>
  Order<br>
  (OrderID): 1 (Auto Increment by 1)<br>
  (ProductID):1<br>
  (Date): 1/1/2009<br></p>
  
  <p>The code is this: </p>
  
  <pre><code>var db = new ProductOrder();
  var idNum = from p in db.Product
              where p.IDNumber == 200900110 
              select p.ProductID; 
  
  var order = new Order();
              order.productID = Convert.ToInt32(idNum);
              order.Date = DateTime.Now;
  db.Order.InsertOnSubmit(nTime);
  db.SubmitChanges();
  </code></pre>
  
  <p>After I run it gives me the error like this: </p>
  
  <blockquote>
    <p>Unable to cast object of type
    'System.Data.Linq.DataQuery`1[System.Int32]'
    to type 'System.IConvertible'</p>
  </blockquote>