SQLite中文排序
  TEZNKK3IfmPf 2023年11月14日 39 0

定义一个类:

SQLite中文排序SQLite中文排序

using System.Data.SQLite;

namespace DAL
{
/// <summary>
/// SQLite中文排序
/// </summary>
[SQLiteFunction(FuncType = FunctionType.Collation, Name = "PinYin")]
public class SQLitePinYingSort : SQLiteFunction
{
public override int Compare(string x, string y)
{
return string.Compare(x, y);
}
}
}

View Code

在Global.asax.cs文件的Application_Start方法中添加如下代码:

SQLiteFunction.RegisterFunction(typeof(SQLitePinYingSort)); //使SQLite支持中文排序

SQL代码:

SQLite中文排序SQLite中文排序

select ct.* 
from mas_channel_type ct
where ct.pId=-1
order by ct.typeName COLLATE PinYin

View Code

【版权声明】本文内容来自摩杜云社区用户原创、第三方投稿、转载,内容版权归原作者所有。本网站的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@moduyun.com

上一篇: jQuery Ajax 下一篇: C# log4net 配置
  1. 分享:
最后一次编辑于 2023年11月14日 0

暂无评论

推荐阅读
  TEZNKK3IfmPf   2024年05月31日   26   0   0 sqlite数据库
  TEZNKK3IfmPf   2023年11月15日   45   0   0 sqlitepython
  TEZNKK3IfmPf   2023年11月14日   31   0   0 javasqlite
  TEZNKK3IfmPf   2023年11月14日   40   0   0 sqlite
  TEZNKK3IfmPf   2023年11月14日   48   0   0 sqlite
  TEZNKK3IfmPf   2023年11月14日   24   0   0 sqlite
TEZNKK3IfmPf