[Mono-dev] Maybe a System.Data.OracleClient.dll bug
John Anderson
sontek at gmail.com
Mon Sep 18 03:00:23 EDT 2006
You have to have the column as NVarchar, Which is national character
set, It saves all data as unicode (utf8) instead of ASCII
On 9/17/06, David <jiangchengyao at gmail.com> wrote:
> I use System.Data.OracleClient to connect and operate oracle database;
> But I find a problem when inserting into oracle database with chinese
> character;
> Here is a simple exapmle:
>
> using System;
> using System.Data ;
> using System.Data.OracleClient;
>
> namespace Test{
> class MainEntry{
> public static void Main(string[] args){
> String connString = "server=video;User Id=mono;password=jcyjcy";
> String insertSql = "INSERT INTO test(name) values (:name)";
> OracleConnection conn = new OracleConnection(connString);
> try{
> conn.Open();
> OracleCommand command = new OracleCommand();
> command.Connection = conn;
> command.CommandText = insertSql;
> command.CommandType = CommandType.Text;
> OracleParameter parm = new OracleParameter(":name",
> OracleType.VarChar);
> // insert a Chinese stiing into oracle database(the string's
> length is 4)
> parm.Value = "²âÊÔ²åÈë";
> command.Parameters.Add(parm);
> command.ExecuteNonQuery();
> }
> catch(Exception ex){
> Console.WriteLine(String.Format("Error is:
> {0}",ex.Message));
> }
> finally{
> conn.Close();
> }
> }
> }
> }
>
>
> and the create table is :
> create table test(name varchar(1000));
>
> in sqlplus :
> select * from test;
> You will see the result is not we expected,not all the character insert into
> the database.
>
> Can't anybody tell me how to resolve this problem?
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
>
>
More information about the Mono-devel-list
mailing list