C# 在c中对sqlite中的数据进行排序

C# 在c中对sqlite中的数据进行排序,c#,sqlite,sorting,C#,Sqlite,Sorting,如何在c中对sqlite中的数据进行排序?我的代码: static class Rank { private static SQLiteConnection _sqlite_conn; private static SQLiteCommand _sqlite_cmd; private static SQLiteDataReader _sqlite_datareader; static Rank() {

如何在c中对sqlite中的数据进行排序?我的代码:

    static class Rank
    {
        private static SQLiteConnection _sqlite_conn;
        private static SQLiteCommand _sqlite_cmd;
        private static SQLiteDataReader _sqlite_datareader;
        static Rank()
        {
            // Create a new database connection
            _sqlite_conn = new SQLiteConnection("Data Source=Highscores.sqlite;Version=3;");
        }

        public static void SortDataBase()
        {
            _sqlite_conn.Open();
            string sql = "SELECT * FROM 'Highscores' order by 'Time'";
            _sqlite_cmd = new SQLiteCommand(sql, _sqlite_conn);
            _sqlite_conn.Close();
        }
    }

但这不起作用。你能帮我吗?时间是int值。

您不能对数据库表本身中的数据进行排序,但可以在选择时对其进行排序。因此,例如,按时间顺序从高分中选择*应该可以工作,但您必须使用_sqlite_cmd.ExecuteReader实际执行您的语句,它返回一个可用于迭代数据的读取器。
请参阅此链接:

尝试此操作,根据时间升序成功排序数据


string selectsql=按时间ASC从googledrive订单中选择文件名、大小、时间

您不需要在每个属性之前和之后使用“before”和“after”。还有,您到底想实现什么?我想按时间值对表进行排序