 |
|
การ Order By ภาษาไทย ด้วย Entity Framework 6 (db.xxx.OrderBy(...), db.xxx.OrderByDescending(...) ) |
|
 |
|
|
 |
 |
|
ผมมี ฐานข้อมูล ของ MS2012 ตัวหนึ่ง ( Collation = Thai_CI_AS ) แล้วได้ติดต่อโดย EF 6 โดยที่เครื่องทำงาน ก็ปกติทุกอย่าง โดยที่ Connect DB ไปยัง Server ตัวที่จะใช้จริง แต่ เมื่อได้ Publish.. ออกไปไว้บน Server ทุกอย่างปกติ แต่ติดตรงการ เรียงลำดับ อักษรภาษาไทย
เครืองทำงาน => ปกติ ( เรียงอักษรก่อน สระ ) กา, เก, ขา, เข, เว 
เครื่อง Server => เรียง สระก่อน อักษร เช่น เก, เข, เว, กา, ขา 
ผมจะต้องแก้ไขยังไงครับ ขอบคุณล่วงหน้า
Tag : .NET, Ms SQL Server 2012, Web (ASP.NET), C#
|
|
 |
 |
 |
 |
Date :
2015-04-28 12:02:20 |
By :
wit_peter |
View :
2337 |
Reply :
2 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ลองดูแบบนี้ครับ
Code (C#)
class Program
{
static void Main()
{
// Set Denmark as current culture
Thread.CurrentThread.CurrentCulture = new CultureInfo("da-DK");
var cities = new[] { "Århus", "Ans", "Balle" };
// When ordering the cities indicate that you want to
// take the current culture into account
cities = cities.OrderBy(a => a, StringComparer.CurrentCulture).ToArray();
foreach (var city in cities)
{
Console.WriteLine(city);
}
}
}
|
 |
 |
 |
 |
Date :
2015-04-29 08:10:21 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ยังไม่ได้เหมือนเดิมครับ... สระ นำเหมือนเดิมครับ เดี่ยวอีกรอบ แต่ยังไงก็ขอบคุณครับที่ช่วย
|
ประวัติการแก้ไข 2015-04-30 09:11:13
 |
 |
 |
 |
Date :
2015-04-30 09:10:21 |
By :
wit_peter |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|