473,748 Members | 2,217 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2071
How about posting those errors you were getting? We're not psychic...

Jerry

"hao" <ph******@hotma il.com> wrote in message
news:eR******** ******@TK2MSFTN GP09.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******@hotma il.com> wrote in message
news:Ob******** ******@tk2msftn gp13.phx.gbl...
How about posting those errors you were getting? We're not psychic...

Jerry

"hao" <ph******@hotma il.com> wrote in message
news:eR******** ******@TK2MSFTN GP09.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******@hotma il.com> wrote in message
news:Ob******** ******@tk2msftn gp13.phx.gbl...
How about posting those errors you were getting? We're not psychic...

Jerry

"hao" <ph******@hotma il.com> wrote in message
news:eR******** ******@TK2MSFTN GP09.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.CommandTe xt = "INSERT INTO Table1(Field1, Field2) VALUES(?, ?)";

dbCmd.Parameter s.Add("@Field1" , FieldValue1);
dbCmd.Parameter s.Add("@Field2" , YourChineseWord s);

dbCmd.ExecuteNo nQuery();

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******@hotma il.com> wrote in message
news:eJ******** ******@TK2MSFTN GP10.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******@hotma il.com> wrote in message
news:Ob******** ******@tk2msftn gp13.phx.gbl...
How about posting those errors you were getting? We're not psychic...

Jerry

"hao" <ph******@hotma il.com> wrote in message
news:eR******** ******@TK2MSFTN GP09.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
2816
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
1943
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(" & val1 & ", '" & val2 & "',...")"
20
18382
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 been doing something like delete from foo where name = 'xx'; insert into foo values('xx',1,2,...);
6
6671
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, I click the Add button to add a new row to the database, and then I click the Update button to save the new database to the external memory. The methods I used are below.
9
1370
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
2087
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 inserting a NULL value. Oddly sometimes it works but I don't know why. Can anyone suggest anything else I can try? Perhaps this is the wrong group I'm posting to - it was just the one that came up with other errors giving the same message, but none of...
3
1704
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 then import them to the database. The performance of the interface was about 20000 records/0.5 hrs. However, if I query the table using "SELECT COUNT(*) FROM TABLE" from the SQL Data Manager of Pervasive Control Center during the importation
5
1928
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 = "abc"; std::string shifted_foo = shifted_insert(foo, 'd'); shifted_foo should after the shifted_insert() equal "dab".
6
12004
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.) Is an "Cannot insert duplicate key row" exception from a FormView returned as part of the ItemInserting or ItemInserted event? 2.) What is the recommended way to catch and deal with an "Cannot
0
8979
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
8818
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9522
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9355
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9307
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6069
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4860
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2773
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2203
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.