Re: VB Chinese Code Problem
- From: "Tony Proctor" <tony_proctor@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 18 Sep 2007 18:31:54 +0100
Unicode String constants in SQL must be prefixed by an 'N' character, e.g.
strsql = "insert into test (test) values (N'" & Text1.Text & "')"
Tony Proctor
"hon123456" <peterhon321@xxxxxxxxxxxx> wrote in message
news:1190125099.482659.112900@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On 9 18 , 6 38 , "Tony Proctor"is
<tony_proctor@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
Column types like nvarchar will store text in Unicode format. When this
applyread into VB6 String variables it is also Unicode. Hence, you must not
any further translations on top of this or it will corrupt the character
codes.
Similarly, when storing String variables back to the database, no
translation should happen because both ends are Unicode.
In order to successfully show the Chinese characters on your screen, you
must have a Chinese version of Windows. Setting the Regional setting to
English will cause those characters to appear as "??"
Can you show us some code, or provide a few more details about where the
data begins and ends?
Tony Proctor
"hon123456" <peterhon...@xxxxxxxxxxxx> wrote in message
news:1190105686.354249.254980@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Dear all,
I am using Chinese VB 6 in Chinese XP, and my backend is sql
server 2000. I have set
the field in Sql Server to nvarchar. I have a combo box with several
Chinese item. When I save
the record, the Chinese become ?? in the Database. I have try several
solution in following
1. Set the connection string with Auto Translate = false
2. Use Strconv function to convert the string to Unicode.
3. Download third party control Unitoolbox.
4. Set the Regional setting to English in Control Panel.
After all have been done, VB still save the Chinese into the database
with ??
What is the problem. Please help.
Thank- -
- -
Dear Tony,
I have tried not to add anything to the VB and SQL
Server, but When
the user enter Chinese Character to the Text box and save to database,
I can only
see the ?? in the SQL table Test. Please Help.
Dim Cnn As New ADODB.Connection
Dim Rst As New ADODB.Recordset
Cnn.ConnectionString = "Provider=SQLOLEDB.1;Auto
translate=false;Password=sa;Persist Security Info=True;User
ID=sa;Initial Catalog=FIH;Data Source=(local)"
Cnn.CommandTimeout = 0
Cnn.Open
Dim strsql
strsql = "insert into test (test) values ('" & Text1.Text & "')"
Cnn.Execute strsql
.
- Follow-Ups:
- Re: VB Chinese Code Problem
- From: hon123456
- Re: VB Chinese Code Problem
- References:
- VB Chinese Code Problem
- From: hon123456
- Re: VB Chinese Code Problem
- From: Tony Proctor
- Re: VB Chinese Code Problem
- From: hon123456
- VB Chinese Code Problem
- Prev by Date: To the Group
- Next by Date: Re: converting single to integer
- Previous by thread: Re: VB Chinese Code Problem
- Next by thread: Re: VB Chinese Code Problem
- Index(es):
Relevant Pages
|