In a web application, I place two textboxes and button for inserting the data which is not English language. When I insert into SQL Server it is showing only “???????(1877?)” like this, but I taken the data type as nvarchar even though it is not coming in that language, is there any different way to insert and display the text which is not in English language.
CREATE TABLE [dbo].[Multilingual](
[name] [nvarchar](50) NULL,
[address] [nvarchar](50) NULL
) ON [PRIMARY]
GO
string sq = "insert into multilingual (name,address) values ('" + txtname.Text + "','" + txtadd.Text + "')";
cmd = new SqlCommand(sq, con);
cmd.CommandType = CommandType.Text;
int i = cmd.ExecuteNonQuery();
if (i == 1)
{
get();
}
The
INSERTstatement you are generating looks likeIt would need to look like
to avoid the string literals being treated as non Unicode with potential data loss. But do not do this.
As well as the data loss issue your query is vulnerable to SQL injection and your web site will get hacked if exposed to the internet. You should use parameterised queries as discussed in the comments.