C B

C B

  • NA
  • 22
  • 22k

DatePicker with Linq

Feb 3 2012 8:40 AM
Hello

This has to be very simple but for the life of me I cannot get the solution. 

I have a WPF DatePicker and want to use the selected date in a Linq query i.e. I want to query an SQL Server table using the WPF DatePicker date.
The column I want to query is called recordedtime and the DatePicker is called dpLatestDate.

private void cmd_GetDates_Click(object sender, RoutedEventArgs e)
        { 
           Linq_PackageLogsDataContext LP = new Linq_PackageLogsDataContext();

            var findDates = from n in LP.tblPackageLogs
                            where n.recordedtime = dpLatestDate(??What goes here??)
                            select n; 

            GridDate.ItemsSource = findDates;
        }

Thanks for your time.

Cheers

C



Answers (5)