[Mono-dev] Maybe a System.Data.OracleClient.dll bug
David
jiangchengyao at gmail.com
Sun Sep 17 23:27:54 EDT 2006
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?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20060918/473dd0b3/attachment.html
More information about the Mono-devel-list
mailing list