Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# SQL
I need to declare "£" symbol in c# and store it in Sql.
Which is the best data type to use in c# and the value in sql.
Posted 28-Mar-14 1:17am
KRI19450
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

It must be NVARCHAR datatype - otherwise you cannot store those special symbols.
Make sure you really use it like this:
@Symbol NVARCHAR(8) OUTPUT 
SqlParameter resultValue = new SqlParameter("@Symbol", SqlDbType.NVarChar, 8);
See more details on following links
http://www.fileformat.info/info/unicode/char/a3/index.htm[^]
http://www.theasciicode.com.ar/extended-ascii-code/pound-sign-symbol-pound-sterling-ascii-code-156.html[^]
  Permalink  
Comments
Maciej Los at 29-Mar-14 16:32pm
   
+5!
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

To store these type of encoding characters or symbols... you can use 'nvarchar' datatype in sql...
and for c# you can try like this
 
"INSERT INTO table_name VALUES(N'£')";
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 384
1 Maciej Los 290
2 Sergey Alexandrovich Kryukov 230
3 CPallini 170
4 Shweta N Mishra 165
0 OriginalGriff 7,760
1 Sergey Alexandrovich Kryukov 7,072
2 DamithSL 5,604
3 Manas Bhardwaj 4,986
4 Maciej Los 4,785


Advertise | Privacy | Mobile
Web03 | 2.8.1411023.1 | Last Updated 28 Mar 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100