从c#form插入unicode数据到oracle 11g? [英] inserting unicode data from c# form to oracle 11g?

查看:86
本文介绍了从c#form插入unicode数据到oracle 11g?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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();

推荐答案

在oracle这样的数据'????????' - 其中?在网络界面?这并不意味着它确实是错误的 - 可能是该网页的编码问题。

由于您可以从命令行插入数据,因此列定义可能没问题。

我要更改C#代码。而不是连接SQL查询,而是使用参数化查询。

"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);
com.ExecuteNonQuery();


这篇关于从c#form插入unicode数据到oracle 11g?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆