I am developing a windows application in which the input is in marathi language. I have the code to insert data in sql server.
just check once the above query in sql, you will understand it. If u write the query using N prefix then in sql it shows the data properly, but if don't use N prefix then it shows ??????? in sql server.
But now my problem is that I am trying to do same from my window application. I wrote the following code.
How can I achieve this? Please Help....
Code
create database TestCode
create table marathi(Names nvarchar(22))Code
insert marathi SELECT N'???????' ---- Right QueryCode
insert marathi SELECT '???????' ---- Wrong QueryCode
select *from marathiBut now my problem is that I am trying to do same from my window application. I wrote the following code.
Code
SqlCommand slc = con.CreateCommand();Code
slc.CommandText = "Insert into marathi values(@Names)"Code
slc.Parameters.Add("@Names", SqlDbType.NVarChar, 22);Code
slc.Parameters["@Names"].Value = textBox1.Text;Code
slc.ExecuteNonQuery();
Afzaal Ahmad ZeeshanRank #60 · 27.6K pointsPosted Mar 15, 2015, 8:10 AM EDT
A similar article was written by me, which covers SQL Server databases too. You can read that article here. Hopefully that article would clarify the basic concept of Unicode character encodings in .NET framework.