store arabic in SQL database

Viewed 90720

I tried to store Arabic string in SQL 2008 database but it converted to " question mark " why ? and what should I do ?

9 Answers

Try using this:
the column Data type is nvarchar()

INSERT INTO CompanyMaster values(N'" + txtCompNameAR.Text + "',N'" + txtCompAddressAR.Text + "','" + txtPh.Text + "')

Add 'N' before every value. example:

INSERT INTO table1 VALUES(N'aaaaaaaaa',N'ששששששששששששש',N'aaaaaaaaaaa',N'ششششششششششش')

This is helpful but work here's what works for me in all cases

ALTER DATABASE [database] SET SINGLE_USER WITH ROLLBACK IMMEDIATE;

GO

ALTER DATABASE [database] COLLATE ARABIC_CI_AS;

GO

ALTER DATABASE [database] SET MULTI_USER;

GO

update: eventually I have to change datatype varchar to nvarchar in my project

Related