Click here to Skip to main content
15,113,873 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
when i want to insert some unicode data from c# form to oracle 11g EX ... in oracle the data like this '????????' but when i want to insert unicode data from oracle command it does not have any problem.
insert into depts values (8,'?????')
it does not have a problem (oracle sql command) but in c# i use
com.CommandText = "insert into DEPTS values('"+dept_cod_txt.Text+"','"+dept_name_txt.Text+"')"; com.ExecuteNonQuery();

1 solution

"in oracle the data like this '????????'" - where? In a web interface? That does not mean that it is really wrong - could be an encoding problem of that web page.
Since you can insert the data from a commandline, the column definition is likely ok.
I'd change the C# code. Instead of concatenating the SQL query, use a parameterized query.
com.CommandText = "insert into DEPTS values(:param1, :param2)"; 
com.Parameters.AddWithValue(":param1", dept_cod_txt.Text);
com.Parameters.AddWithValue(":param2", dept_name_txt.Text);

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