Solved

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

Posted on 2014-03-19
3
776 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
Comment Utility
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
Comment Utility
what collation are you using for your database?? You may have to do nothing.
0
 

Author Closing Comment

by:RBS
Comment Utility
Thanks
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

743 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

17 Experts available now in Live!

Get 1:1 Help Now