Unable to store a Korean string in the database using LINQ

advertisements

I'm using this code to store korean string in my database:


Dim username As String = Request.QueryString.Get("Some Korean String")
Using dg As New DataContext()
Dim newfriend As New FriendsTable With {.AskingUser = User.Identity.Name, .BeingAskedUser = username, .Pending = True}
dg.FriendsTables.InsertOnSubmit(newfriend)
dg.SubmitChanges()
end using

Checking my database, the username stored is a string"????"... anybody got an idea how this happened or any workarounds?


It sounds like you are storing Korean text in a varchar/text column which is not using a Korean collation. Thea easiest fix is to change the column type to nvarchar/ntext.

The nchar column types store Unicode data, whereas the char and varchar types store single byte characters in the specified collation.