如何在SQL Compact 4.0中对列进行排序? [英] How do I sorting a column in SQL compact 4.0 by default?

查看:65
本文介绍了如何在SQL Compact 4.0中对列进行排序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用sql compact 4.0来查看我的数据库表。第一列是 Id ,默认情况下不会对表的行进行升序排序。我添加了一个示例来显示案例,其中207和208在196之前出现。



sql compact 4 - Postimage.org [ ^ ]

如何默认对该列进行升序排序?



我的尝试:



Hi, I am using sql compact 4.0 to view my database table. The first column is Id, which does not sort the table's rows ascendingly by default. I have added an example to show the case, where 207 and 208 come before 196.

sql compact 4 — Postimage.org[^]
How can I sort this column ascendingly by default?

What I have tried:

[Key]
[Index]        
public int Id { get; set; }





但它不起作用。



But it is not working.

推荐答案

没有这样做默认情况下。



显示排序记录是一个UI功能,而不是数据库默认执行的操作。如果查询未明确说出ORDER BY,则从数据库获取记录的顺序无法保证。如果您希望对记录进行排序,则必须在查询命令中指定。
There is no such thing as doing this "by default".

Showing sorted record is a UI function, not one the database does "by default". The order you get records from the database if the query did not explicitly say "ORDER BY" is not guaranteed. If you want the records sorted, you're going to have to specify that in the query command.


这篇关于如何在SQL Compact 4.0中对列进行排序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆