When using LINQ to Entities how do you test for the object to have no result? For example, the following query will return no result if the custid has no order history BUT the page will still load, it just won't have a gridview because there is no datasource for it to bind to.
Dim result = From c In ctx.orders
Where c.CustomerId = custId
Join prod In ctx.products On prod.Id Equals c.ProductId
Select New With
{c.OrderDate,
c.PurchaseOrderNumber,
prod.description,
c.ProductPrice,
c.ProductQty}
How do you test the object for no result? I want to test for that to supply different markup to the page if no result is returned. Obviously I've tried If result = vbNull, also tried Is Nothing, those don't work. The other problem is when using this query in a Try Catch block, even when no result is returned it does not catch an exception, I'm guessing it doesn't see that as an error.