定义一个类:
class="code_img_closed" src="/Upload/Images/2014122318/0015B68B3C38AA5B.gif" alt="" />logs_code_hide('0fca687d-a36e-47ce-a627-835a07ecd813',event)" src="/Upload/Images/2014122318/2B1B950FA3DF188F.gif" alt="" />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代码:
select ct.* from mas_channel_type ct where ct.pId=-1 order by ct.typeName COLLATE PinYinView Code