Click here to Skip to main content
11,581,402 members (60,650 online)
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 0:17am
KRI19517
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 340
1 Sergey Alexandrovich Kryukov 155
2 virusstorm 114
3 Frankie-C 105
4 RyanDev 84
0 OriginalGriff 1,273
1 Sergey Alexandrovich Kryukov 895
2 Abhinav S 597
3 F-ES Sitecore 500
4 Suvendu Shekhar Giri 433


Advertise | Privacy | Mobile
Web03 | 2.8.150603.1 | Last Updated 28 Mar 2014
Copyright © CodeProject, 1999-2015
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