How can I use Linq-To-SQL to load a DataGridView?
Would the following work?
DCDataContext db = new DCDataContext();
dataGridViewJobs.DataSource = db.jobs.Select(p => p.closeDate <= DateTime.Now);
How can I use Linq-To-SQL to load a DataGridView?
Would the following work?
DCDataContext db = new DCDataContext();
dataGridViewJobs.DataSource = db.jobs.Select(p => p.closeDate <= DateTime.Now);
Yes. But you should change your query, since select is not used for querying like in sql but for projecting the elements of a sequence into a new form.
The following example should work:
DCDataContext db = new DCDataContext();
dataGridViewJobs.DataSource = (from jobs in db.jobs
where p.closeDate <= DateTime.Now
select jobs);