inserting Turkish chars into sql server

S

Sergei Shelukhin

Hi.

Here's the problem.
I have ASP.NET web app and SQL Server 2k database.
In the app, there's this button handler.

string sql = "INSERT INTO Word (Word,WTranslation,Comment) VALUES
('"+txWord.Text.Trim()+"','"+txTranslation.Text.Trim()+"','"+txComment.Text.Trim()+"')";
SqlCommand cmd = new SqlCommand(sql,cn);
cn.Open();
cmd.ExecuteNonQuery();
cn.Close();
txComment.Text = cmd.CommandText;

Last line is for testing purposes.
txWord field contains Turkish characters (C with cedilla, g with breve etc).
When I submit the form, I get the right output in the comment field,
e.g. all the letters are with cedillas, breves etc. I don't know if they
(symbols) will work with ngs, but here's the query example:

INSERT INTO Word (Word,WTranslation,Comment) VALUES ('çĞ','hhh','')

Problem is that in SQL Servr database, symbols lose all their fancy
stuff and come out as standart c-s, g-s etc.

Default collation for the db is cyrillic, Word column collation is set
to Turkish but it doesn't help.
The same results are produced when I run the query from the query analyzer.
How do I fix this?
 
S

Sergei Shelukhin

Sergei Shelukhin wrote:

Nevermind. Only needed to add N to the query, like (N'"+....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top