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

Cannot "Insert" Chinese Char

hao
Hi, all

When I use ASP to insert an record to a database, I got
some errors and can not insert any value with Chinese Char.
The only way I can do that is use "rst1.Addnew...rst1.update".
Anyone know why?
thx

hao
Nov 17 '05 #1
4 2048
How about posting those errors you were getting? We're not psychic...

Jerry

"hao" <ph******@hotmail.com> wrote in message
news:eR**************@TK2MSFTNGP09.phx.gbl...
Hi, all

When I use ASP to insert an record to a database, I got
some errors and can not insert any value with Chinese Char.
The only way I can do that is use "rst1.Addnew...rst1.update".
Anyone know why?
thx

hao

Nov 17 '05 #2
hao
Hi Jerry,

If I use "INSERT INTO ...", the error message is :
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] Syntax error in string in query
expression '''. /oa/send.asp, line 199
If I use "response.write" to track the sql string, I found the string was
terminated by the first of the Chinese Char(no Chinese Char can be read)
like this:

The Original SQL string:
INSERT INTO Table1(Field1, Field 2) VALUE('" & FieldValue1 & "', '" &
MyChineseWords & "')"

I got this result:
INSERT INTO Table1(Field1, Field 2) VALUE('abc', '

which the second field is my Chinese Char. No idea why the string
terminated.
If I use "rs.AddNew...." no error message and only a null value saved in the
table. I use "response.write" to
track the value before save to the table, it's still empty.

Lokks like the value MyChineseWords has some symbol and the system think
it's the end of string. I get MyChineseWords from a text form area that
input by user. There is no problem which English Charactor, only in Chinese.
hao

"Jerry III" <je******@hotmail.com> wrote in message
news:Ob**************@tk2msftngp13.phx.gbl...
How about posting those errors you were getting? We're not psychic...

Jerry

"hao" <ph******@hotmail.com> wrote in message
news:eR**************@TK2MSFTNGP09.phx.gbl...
Hi, all

When I use ASP to insert an record to a database, I got
some errors and can not insert any value with Chinese Char.
The only way I can do that is use "rst1.Addnew...rst1.update".
Anyone know why?
thx

hao


Nov 17 '05 #3
hao
The database I used is Access and I know if I use SQL Server, I should add a
'N' before it
to indicate the unicode. But I do not know how to do in Access. Seems the
'N' does not work
in Access.
hao

"Jerry III" <je******@hotmail.com> wrote in message
news:Ob**************@tk2msftngp13.phx.gbl...
How about posting those errors you were getting? We're not psychic...

Jerry

"hao" <ph******@hotmail.com> wrote in message
news:eR**************@TK2MSFTNGP09.phx.gbl...
Hi, all

When I use ASP to insert an record to a database, I got
some errors and can not insert any value with Chinese Char.
The only way I can do that is use "rst1.Addnew...rst1.update".
Anyone know why?
thx

hao


Nov 17 '05 #4
I've never worked with Access, so I'm not sure if it even supports Unicode
strings but my suggestion would be to use Command object and add your
strings as parameters, like this (I suppose the space between Field and 2
and using VALUE instead of VALUES were just typos in your other post):

dbCmd.CommandText = "INSERT INTO Table1(Field1, Field2) VALUES(?, ?)";

dbCmd.Parameters.Add("@Field1", FieldValue1);
dbCmd.Parameters.Add("@Field2", YourChineseWords);

dbCmd.ExecuteNonQuery();

If that doesn't work then Access doesn't support Unicode as it is. In that
case you might have to encode your Unicode strings to UTF-8 before inserting
and remembering to decode them when reading.

Jerry

"hao" <ph******@hotmail.com> wrote in message
news:eJ**************@TK2MSFTNGP10.phx.gbl...
The database I used is Access and I know if I use SQL Server, I should add a 'N' before it
to indicate the unicode. But I do not know how to do in Access. Seems the
'N' does not work
in Access.
hao

"Jerry III" <je******@hotmail.com> wrote in message
news:Ob**************@tk2msftngp13.phx.gbl...
How about posting those errors you were getting? We're not psychic...

Jerry

"hao" <ph******@hotmail.com> wrote in message
news:eR**************@TK2MSFTNGP09.phx.gbl...
Hi, all

When I use ASP to insert an record to a database, I got
some errors and can not insert any value with Chinese Char.
The only way I can do that is use "rst1.Addnew...rst1.update".
Anyone know why?
thx

hao



Nov 17 '05 #5

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

Similar topics

2
by: sm | last post by:
How to "Insert" (not append) new text segment to an existing text file? Assume that we have text file as shown below; Elvis Sofia Kylix BCB--> How to insert here? Atten BuilderX Roma
6
by: Rich | last post by:
Hello, I have to create a table in an Access mdb (remotely) on the fly. Create Table tbl1(fld1 Integer, fld2 varchar(10), fld3...) Then I have to insert data: Insert Into tbl1 Values(" &...
20
by: Mark Harrison | last post by:
So I have some data that I want to put into a table. If the row already exists (as defined by the primary key), I would like to update the row. Otherwise, I would like to insert the row. I've...
6
by: Christopher Lusardi | last post by:
How can I fix this? When I do the below I get the error message: "Cannot insert explict value for identity column in table 'Employees' when IDENTITY_INSERT is set to OFF." To get this message,...
9
by: Guy Cohen | last post by:
Hi all as part of Insert I use Now() The type in the database is shortdatetime. What is the correct format to insert now()? Guy
0
by: diane | last post by:
Just trying to upsize using VFP 9 with SQL 2005 using VFP remote views. One in particular keeps coming up and saying Cannot insert the value NULL into column, when I really don't think I am...
3
by: 01423481d | last post by:
Hi All I am facing a very strange "problem" on the captioned issue, I hope I can explain it clearly. Actually I am developing an interface (using VB.net) which read records from a file and...
5
by: Eric Lilja | last post by:
Is there something "elegant" in the standard library I can use to perform a "shifted insert" in a std::string? Let me examplify what I mean with shifted insert. Say I have: std::string foo =...
6
by: Dave | last post by:
I really don't like the users getting an unhandled expception page, and I'm still to new with ASP.Net and C#. So please accept my appology for the 2 part question. SqlException (0x80131904) ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.