Skip to Main Content

ODP.NET

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

trouble inserting unicode values by command text

450721Apr 4 2006 — edited Apr 11 2006
Hi everyone,

I have one table in Oralce 10g: tblUnicode (name nvarchar2(100)), I'm using Oracle.DataAccess.dll version 10.2.0.100.

When I insert a row with parameterized query:

string commText = "insert into tblUnicode values (:a)";
OracleCommand comm = new OracleCommand(commText, conn);
comm.Parameters.Add("a", OracleDbType.NVarchar2, 100).Value = "Unicode string";
comm.CommandType = CommandType.Text;
comm.ExecuteNonQuery();

=> everything is ok (the Unicode string is stored correctly in database)

but, when I try to put value in the single query (not using parameter)

string commText = "insert into tblUnicode values (N'Unicode string')";
OracleCommand comm = new OracleCommand(commText, conn);
comm.CommandType = CommandType.Text;
comm.ExecuteNonQuery();

=> the value is inserted to database is not correct '?*^&#'

Anyone knows why?

Thanks in advanced.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 9 2006
Added on Apr 4 2006
7 comments
5,211 views