Unicode Collations problem ?
Posted
by Bayonian
on Stack Overflow
See other posts from Stack Overflow
or by Bayonian
Published on 2009-04-02T04:22:41Z
Indexed on
2010/04/05
20:03 UTC
Read the original article
Hit count: 753
(.NET 3.5 SP1, VS 2008, VB.NET, MSSQL Server 2008)
I'm writing a small web app to test the Khmer Unicode and Lao Unicode. I have a table that store text in Khmer Unicode with the following structure :
[t_id] [int] IDENTITY(1,1) NOT NULL
[t_chid] [int] NOT NULL
[t_vn] [int] NOT NULL
[t_v] [nvarchar](max) NOT NULL
I can use Linq to SQL to do CRUD normally. The text display properly on the web page, even though I didn't change the default collation of MSSQL Server 2008.
When it comes to search the column [t_v], the page will take a very long time to load and in fact, it loads every row of that column. It never compares with the "key word" criteria that I use for the search. Here's my query for the search :
Public Shared Function SearchTestingKhmerTable(ByVal keyword As String) As DataTable
Dim db As New BibleDataClassesDataContext()
Dim query = From b In db.khmer_books _
From ch In db.khmer_chapters _
From v In db.testing_khmers _
Where v.t_v.Contains(keyword) And ch.kh_book_id = b.kh_b_id And v.t_chid = ch.kh_ch_id _
Select b.kh_b_id, b.kh_b_title, ch.kh_ch_id, ch.kh_ch_number, v.t_id, v.t_vn, v.t_v
Dim dtDataTableOne = New DataTable("dtOne")
dtDataTableOne.Columns.Add("bid", GetType(Integer))
dtDataTableOne.Columns.Add("btitle", GetType(String))
dtDataTableOne.Columns.Add("chid", GetType(Integer))
dtDataTableOne.Columns.Add("chn", GetType(Integer))
dtDataTableOne.Columns.Add("vid", GetType(Integer))
dtDataTableOne.Columns.Add("vn", GetType(Integer))
dtDataTableOne.Columns.Add("verse", GetType(String))
For Each r In query
dtDataTableOne.Rows.Add(New Object() {r.kh_b_id, r.kh_b_title, r.kh_ch_id, r.kh_ch_number, r.t_id, r.t_vn, r.t_v})
Next
Return dtDataTableOne
End Function
Please note that I use the exact same code and database design with Lao Unicode and it works just fine. I get the returned query as expected for the search.
I can't figure out what the problem with searching for query in Khmer table.
© Stack Overflow or respective owner