Hi everyone,
Recently I have posted a question regarding special characters in text
files. I was trying to read the text file to process the text later on, but
I was using the wrong encoding. The correct encoding turned out to be
extended ASCII (850).
But now I'd like to store the result in a database. I have tried to do this
by just issueing an insert statement, using the following piece of code:
SqlCommand cmd = new SqlCommand(sb.T oString(), conn);
int result = cmd.ExecuteNonQ uery();
This works, but now I'm faced with the same problem, only in reverse - ni
the database, the characters are stored in the wrong encoding!
Is there a way to specify the encoding in which I would like to safe the
characters in the database? What do I need to change in the code?
Thanks in advance,
JayCee
-- http://jcsnippets.atspace.com
a collection of source code, tips and tricks 4 5463
If you change the field to a Unicode field, e.g. ntext or nvarchar, it
can handle the characters without problem.
jcsnippets.atsp ace.com wrote: Hi everyone,
Recently I have posted a question regarding special characters in text files. I was trying to read the text file to process the text later on, but I was using the wrong encoding. The correct encoding turned out to be extended ASCII (850).
But now I'd like to store the result in a database. I have tried to do this by just issueing an insert statement, using the following piece of code: SqlCommand cmd = new SqlCommand(sb.T oString(), conn); int result = cmd.ExecuteNonQ uery();
This works, but now I'm faced with the same problem, only in reverse - ni the database, the characters are stored in the wrong encoding!
Is there a way to specify the encoding in which I would like to safe the characters in the database? What do I need to change in the code?
Thanks in advance,
JayCee
Göran Andersson <gu***@guffa.co m> wrote in
news:#Y******** ******@TK2MSFTN GP04.phx.gbl: If you change the field to a Unicode field, e.g. ntext or nvarchar, it can handle the characters without problem.
Alas, the field I'm using already is nvarchar.
If I print the insert statement to the console window prior to passing it
to the database, the characters are correct. After the insert, they no
longer appear correct in the database (nor in the application that uses
said database).
Thanks,
JayCee
-- http://jcsnippets.atspace.com
a collection of source code, tips and tricks
What do you use to insert the record? If you build the SQL query
yourself, remember that you have to put an N in front of a string
constant to make it Unicode.
jcsnippets.atsp ace.com wrote: Göran Andersson <gu***@guffa.co m> wrote in news:#Y******** ******@TK2MSFTN GP04.phx.gbl:
If you change the field to a Unicode field, e.g. ntext or nvarchar, it can handle the characters without problem.
Alas, the field I'm using already is nvarchar.
If I print the insert statement to the console window prior to passing it to the database, the characters are correct. After the insert, they no longer appear correct in the database (nor in the application that uses said database).
Thanks,
JayCee
Göran Andersson <gu***@guffa.co m> wrote in
news:OK******** ******@TK2MSFTN GP04.phx.gbl: What do you use to insert the record? If you build the SQL query yourself, remember that you have to put an N in front of a string constant to make it Unicode.
Ah, I was not aware of that. I'm indeed building the SQL query myself, and
now that the N is in front of each String constant, the result in the
database looks fine.
Thank you very much!
Best regards,
JayCee
-- http://jcsnippets.atspace.com
a collection of source code, tips and tricks This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: edmondlch |
last post by:
I am using a VB 6.0 application programs to insert some chinese
traditional characters into the MS SQL Server 6.5 database. It is normal
when the application running in the server locally. However, when I
remote run the application, the chinese characters will appear in ????.
Any solution for solving this problem?
--
Posted via http://dbforums.com
|
by: hartley_aaron |
last post by:
Hi,
I have an application running on a wireless device and being wireless I
want it to use bandwidth as efficiently as possible. Therefore, I want
the SQL statement that it uploads to the SQL Server to be as efficient
as possible. In one instance, I give it four records to upload, which
currently I have as four seperate SQL statements seperated by a ";".
However, all the INSERT INTO... information is the same each time, the
only that...
|
by: baustin75 |
last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie
only when debugging in php designer 2005
--------------------------------------------------------------------------------
Hello,
I have a very simple problem but cannot seem to figure it out. I have a
very simple php script that sends a test email to myself. When I debug
it in PHP designer, it works with no problems, I get the test email. If
|
by: anony |
last post by:
Hi,
I'm looking to find out how to properly handle the input of certain
characters into a textbox that will be inserted into a database. In this
app, text is copied and pasted into a textbox from various sources, and
sometimes contains the funky curly quotes and apostrophes which end up being
dropped on the database insert. I'm not sure if the issue resides in my
asp.net code or in the database itself (SQL 2000). Thanks for any help.
|
by: teddysnips |
last post by:
I need a trigger (well, I don't *need* one, but it would be optimal!)
but I can't get it to work because it references ntext fields.
Is there any alternative? I could write it in laborious code in the
application, but I'd rather not!
DDL for table and trigger below.
TIA
| |
by: Pedro Pinto |
last post by:
Hi there once more........
Instead of showing all the code my problem is simple.
I've tried to create this function:
char temp(char *string){
alterString(string);
return string;
|
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 table thus:
CREATE TABLE "TBL_TEST_CH"
|
by: AG |
last post by:
ASP.NET 2.0 aspx page with a FormView bound to an ObjectDataSource to view,
add and edit records.
Can anyone point me to a sample of how to retain the user entered control
values when an insert fails?
In other words, when inserting a new record, user enters data in the
controls, but the insert fails.
When the page posts back all the controls are empty or at their default
values.
I would like to retain the user enter values so they can...
|
by: =?Utf-8?B?bXBhaW5l?= |
last post by:
Hello,
I am completely lost as to why I can't update a DropDownList inside a
DetailsView after I perform an insert into an object datasource. I tried to
simply it down to the core demostration:
default.aspx:
|
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...
|
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...
| |
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,...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |