473,323 Members | 1,589 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,323 software developers and data experts.

Store Chinese Text

YAN
my database (mysql) would be used to store Simplified Chinese and Traditional
Chinese, so i would like to store the text as unicode to the database.

I know there is a function Encoding.Unicode.getByte, and i would like to use
in this way:
Dim source As Byte() = System.Text.Encoding.Unicode.GetBytes("ä¸*国")

After i get the Byte Array, how can i store the array by INSERT SQL statement?
Jul 21 '05 #1
3 1913
Hi YAN,

Use an SqlParameter to assign the byte array to the insert statement.

--
Happy Coding!
Morten Wennevik [C# MVP]
Jul 21 '05 #2
YAN
Hi Morten Wennevik,

Thanks for ur reply.

However, can u kindly give me an example, i have no idea about this, THANKS

YAN

"Morten Wennevik" wrote:
Hi YAN,

Use an SqlParameter to assign the byte array to the insert statement.

--
Happy Coding!
Morten Wennevik [C# MVP]

Jul 21 '05 #3
Hi YAN,

Sorry I couldn't reply earlier. Seeing as you use mysql you would
probably need to use OleDbParameter with an OleDbCommand.

You would typically do something like this (c#)

OleDbParameter param1 = new OleDbParameter("@MyParameter",
OleDbType.Binary);
param1.Value = source;

OleDbCommand insertCommand = new OleDbCommand();
insertCommand.CommandText = "INSERT INTO MyTable Values(@MyParameter)";
insertCommand.Parameters.Add(param1);

Note that this code isn't tested and may not be entirely correct.

Note also, thay you may not be able to use named parameters in the insert
text, in which case I believe you need to use ? as in "INSERT INTO MyTable
Values(?)" and the parameters need to be added to the command in the
proper sequence.

--
Happy Coding!
Morten Wennevik [C# MVP]
Jul 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Kobi Lurie | last post by:
Hello all, I'm trying to make a simple script beginner level script, with just functions. it uses the functions: file_get_contents substr taking into an array the text substr took then...
1
by: YAN | last post by:
i cannot store unicode in thie way, please help! Dim souce As Byte() = System.Text.Encoding.Unicode.GetBytes("CHINESE") Dim sSql As String = "insert into tblpitems (fldItmDesc1) values (@a)"...
3
by: Antonio | last post by:
Hi, I want to read an html page written in chinese and store it in a file having extension .aspx , I'm not sure where is the problem, I use the following lines of code: String sAddress =...
1
by: Anthony Liu | last post by:
I believe that topic related to Chinese processing was discussed before. I could not dig out the info I want from the mail list archive. My Python script reads some Chinese text and then split...
8
by: pabv | last post by:
Hello all, I am having a few issues with encoding to chinese characters and perhaps someone might be able to assist. At the moment I am only able to see chinese characters when displayed as...
7
by: c.verma | last post by:
I have a web application. There is a page which has a datagrid on it.The datagrid displays the data that comes from SAP. SAP sends the chinese characters to this grid. Before I display CHinese...
3
by: YAN | last post by:
my database (mysql) would be used to store Simplified Chinese and Traditional Chinese, so i would like to store the text as unicode to the database. I know there is a function...
0
by: kennymce | last post by:
Hi, I'm having trouble localizing my Oracle 9.2 / ASP web application for our Chinese-speaking users. My Oracle 9.2 Database has NLS_NCHAR_CHARACTERSET set to AL16UTF16. I've set up a test...
4
by: Sebastian.Pawlus | last post by:
Hi, I have a problem with Chinese words coded in utf-8. I need to display Chinese marks/words with use of GD or IMagick libs. Chinese text that I need to display is written as plain text in .txt...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.