473,405 Members | 2,344 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,405 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 1916
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.