473,386 Members | 1,693 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,386 software developers and data experts.

store chinese again

YAN
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)"
g_dbCommand.CommandText = sSql
Dim paramData As MySqlParameter = New MySqlParameter("@a",
ByteFX.Data.MySqlClient.MySqlDbType.VarChar)
paramData.Value = souce
g_dbCommand.Parameters.Add(paramData)
DBConnection.ExecuteNonQuery()

i store the string as "System.Byte[]", what can i do?
Jul 21 '05 #1
1 1440
YAN <YA*@discussions.microsoft.com> wrote:
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)"
g_dbCommand.CommandText = sSql
Dim paramData As MySqlParameter = New MySqlParameter("@a",
ByteFX.Data.MySqlClient.MySqlDbType.VarChar)
paramData.Value = souce
g_dbCommand.Parameters.Add(paramData)
DBConnection.ExecuteNonQuery()

i store the string as "System.Byte[]", what can i do?


You've specified that it's a VarChar, which means you should specify a
string, not a byte array.

You really shouldn't *need* to do any encoding/decoding yourself at
all. Are you sure your MySql database has been set up to use Unicode?
(I don't know whether it does by default or not.)

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #2

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

Similar topics

3
by: Coco | last post by:
Hi! I managed to display chinese character in my web form (.aspx), in certain situation i need to to set the text of the label of my web form in chinese character programatically which is done in...
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...
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 =...
0
by: boonkit | last post by:
Currently i store the chinese character in unicode decimal format (&#<number>;). In this way, I can display and search the chinese character correctly. However, this will take more storage space....
177
by: C# Learner | last post by:
Why is C syntax so uneasy on the eye? In its day, was it _really_ designed by snobby programmers to scare away potential "n00bs"? If so, and after 50+ years of programming research, why are...
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...
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)"...
0
by: enrico.leuzzi | last post by:
Hi, sorry for the newbie question but I'm not able to store chinese characters into a column in a table.... how should the db setted and the table created to be able to store different chars...
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...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.