I'm accessing a table from my database. I have added the tables as a dataset in Visual Studio 2013, but when I try to use it, it comes out empty.
This is what I'm trying to do:
IQueryable<NorthwindDataSet.OrdersRow> LookupOrdersForYear(int year)
{
using (var context = new NorthwindDataSet())
{
var orders =
from order in context.Orders
where order.OrderDate != null && order.OrderDate.Year >= year
select order;
return orders.ToList().AsQueryable();
}
}
I found out that orders
was empty, so I added
Console.WriteLine(context.Orders.Count);
which gave me an output of 0. What went wrong?
See Question&Answers more detail:os