I am having trouble accessing data that is stored in different languages, and wondered if anyone here has an experience.
The data is stored in a SQL Server 2000 table, in a field of type nvarchar.
If I do a SELECT query through SQL Query Analyzer or MS Access, I see the data that is stored there properly. In this case, it is a string of Japanese characters.
What I want to do is write the data out to a text file.
I am creating the file as follows:
And then I am attempting to write the values I retrive back in a Dataset as follows:
Finally I flush and close the file as follows:
When I deal with rows that are in the English language, it creates the file successfully.
But when I attempt to do it with rows that contain Japanese characters, I just get weird ASCII characters, not the proper Japanese characters that are stored in the table.
I tried using the StrConv function as such:
But that did not work either.
Any ideas on how foreign language characters stored in SQL can be written to a text file in VB.Net 2003 would be appreciated.
Thank you.
The data is stored in a SQL Server 2000 table, in a field of type nvarchar.
If I do a SELECT query through SQL Query Analyzer or MS Access, I see the data that is stored there properly. In this case, it is a string of Japanese characters.
What I want to do is write the data out to a text file.
I am creating the file as follows:
Code:
Dim fVTMFile As StreamWriter = File.CreateText("C:\test.txt")
Code:
fVTMFile.WriteLine(MyDataRow2("line_text"))
Code:
fVTMFile.Flush()
fVTMFile.Close()
But when I attempt to do it with rows that contain Japanese characters, I just get weird ASCII characters, not the proper Japanese characters that are stored in the table.
I tried using the StrConv function as such:
Code:
fVTMFile.WriteLine(StrConv(MyDataRow2("line_text"), VbStrConv.Katakana))
or
fVTMFile.WriteLine(StrConv(MyDataRow2("line_text"), VbStrConv.Hiragana))
Any ideas on how foreign language characters stored in SQL can be written to a text file in VB.Net 2003 would be appreciated.
Thank you.