Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/67.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# SQL Compact Server 3.5 orderby语句-windows phone_C#_Sql_Wpf_Windows Phone 7_Windows Phone 8 - Fatal编程技术网

C# SQL Compact Server 3.5 orderby语句-windows phone

C# SQL Compact Server 3.5 orderby语句-windows phone,c#,sql,wpf,windows-phone-7,windows-phone-8,C#,Sql,Wpf,Windows Phone 7,Windows Phone 8,我正试图从数据库中输出所有信息。根据我的代码,它是有效的。但它实际上输出了一切。我想按日期订购。我该怎么做呢。下面是我的代码: protected override void OnNavigatedTo(NavigationEventArgs e) { if (!App.ViewModel.IsDataLoaded) { App.ViewModel.LoadData(); } using (Data

我正试图从数据库中输出所有信息。根据我的代码,它是有效的。但它实际上输出了一切。我想按日期订购。我该怎么做呢。下面是我的代码:

protected override void OnNavigatedTo(NavigationEventArgs e)
    {
        if (!App.ViewModel.IsDataLoaded)
        {
            App.ViewModel.LoadData();
        }

        using (DatabaseContext c = new DatabaseContext(DatabaseContext.ConnectionString))
        {
            //c.CreateIfNotExists();
            if (!c.DatabaseExists())
            {
                c.CreateDatabase();
            }

            c.LogDebug = true;
            //output todolist data from database

            try
            {
                MLongListSelector.ItemsSource = c.ToDoList.ToList();
            }
            catch (Exception exc)
            {
                Console.WriteLine(exc.Source + ":" + exc.Message);
            }



        }
    }
要按今天的当前日期和时间订购

DateTime today = DateTime.Today;
var result1 =  c.ToDoList().Where(test => test.Date.Date == today).OrderByDescending(t=>t.Date).ToList();

c、 ToDoList.OrderBy(l=>l.).ToList();c、 ToDoList.OrderBy(l=>l.Date.ToList();这是我在代码中声明的内容。它不起作用。在上面提到的代码中,我没有看到OrderBy。我没有看到任何关于崩溃的信息。你说代码中没有看到OrderBy是什么意思。我该怎么做?从断点开始,MLongListSelector.ItemsSource=null@HamletHakobyan,您的代码正在运行!谢谢也许你可以重新创建一个关于这个问题的帖子,这样我就可以接受它作为答案。但我想搜索的是在今天之前订购。现在在mysqlI中,我需要按当前日期对其进行排序,就像在今天一样。我的ToDolis中没有任何TimeOfDay或Time的扩展方法。我修改了它,Date是您用于dateCollectionList的属性,在我当前的上下文中不存在。老实说,我不明白它的含义
DateTime today = DateTime.Today;
var result1 =  c.ToDoList().Where(test => test.Date.Date == today).OrderByDescending(t=>t.Date).ToList();