Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
4.00/5 (2 votes)
See more:
When we store urdu language data in a database then the values are stored but when we see the data in the database it's not shown correctly - it's shown like this: ???????????????????????
Posted
Updated 15-Feb-12 6:38am
v3
Comments
Herman<T>.Instance 15-Feb-12 9:21am    
do you use varchar or nvarchar in the database

you need to make sure your results are UTF-8 encoded.
 
Share this answer
 
v2
Hello,

If your field type is Nvarchar:

SQL
Create Table TestTable
(
	ID Bigint Identity(1,1) NOT NULL Primary Key,
	Detail nvarchar(200) NOT NULL,
)


For example I've created a stored procedure:

SQL
Create  Procedure   WriteInTestTable(
   @Detail   as  Nvarchar(200)
)
As
Begin

        Insert  TestTable (Detail)
                Values(@Detail)
End



And if I insert value as 'N', for example:

SQL
exec WriteInTestTable N'Some Urdu words...'


Then, I don't see any problem:

SQL
Select	*	From	TestTable
 
Share this answer
 
v3
Comments
Khan Rashid 17-Feb-12 4:47am    
I have already used Nvarchar datatype for store urdu value in database but its not correct syntax display in database ...Display like this.. ??????????????????
PLZ help me any one... AM working final symester uni project
Shahin Khorshidnia 17-Feb-12 14:59pm    
Do you insert values with N keyword?

Insert BlaBla (Name)
Values (N'Ordu')

If you do it, you wont have any problem.

We have this problem with Persian Language too, if we forget 'N' Keyword before the inserting values.

N'Value in Ordu or Persian or Arabic'
Shahin Khorshidnia 18-Feb-12 4:14am    
You have this command :

SqlCommand cmd = new SqlCommand("insert into policrec values('" + polnam.Text + "','" + ....

1. This is not a good idea. Not a secure way (Injection Risk). The user can inject SQL commands instead of it. For example, If user inserts “aaaa’) Drop Table policrec --” as the last parameter, then ops! You know it. Use command.Parameters

2. If you Insist to go your way, Ok, then use N to insert in ordu. for example
values(N'" + polnam.Text + "', N'" + ....

I think you aleary have your answer.
select data type in data field
SQL
nvarchar
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900