Solved

Converting from Single byte to double byte - C# - MS SQL

Posted on 2014-03-19
3
796 Views
Last Modified: 2014-03-22
Hi:

I have a C# application that I need to convert to be able to hold non western characters.  The application then needs to store data in an MS SQL database.

How, for example could I take a non-western word from a text box in C# and then convert it and store in sql database.  If the original field was nvarchar(20) in the db, what type of field should I now use in the db to store it?

Any help greatly appreciated.

RBS
0
Comment
Question by:RBS
3 Comments
 
LVL 29

Accepted Solution

by:
anarki_jimbel earned 500 total points
ID: 39940509
Check the MS link below:

http://msdn.microsoft.com/en-us/library/ms186939.aspx

Nvarchar columns take up twice as much space over the non-unicode counterparts (char and varchar).

When inserting into unicode columns, use N to indicate it's unicode text:

INSERT INTO MyUnicodeTextTable(NvarcharColumnText)
VALUES (N'someUnicode text')
0
 
LVL 78

Expert Comment

by:David Johnson, CD, MVP
ID: 39940653
what collation are you using for your database?? You may have to do nothing.
0
 

Author Closing Comment

by:RBS
ID: 39948198
Thanks
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now