[Mono-dev] Maybe a System.Data.OracleClient.dll bug
David
jiangchengyao at gmail.com
Fri Sep 22 00:48:06 EDT 2006
> Could you please clarify this? If I get you right, you mean that the
> code in the repository does not work, and mono 1.1.17.1 does not
> work.
>
> Surely the code will work if you do it as a single sql statement (if
> it does not, things are FUBAR ;-) ), but it is (in regard to
> performance) better to use OracleParameter. Inserting values into the
> query string manualy is a workaround, but an ugly one, if you ask me.
Yes,I mean the OracleParameter bugs still exist in the newest version
of System.Data.OracleClient.dll and Mono 1.17.1.
> Can you please send me both the code you use to create the table and
> the c# code you have tried to execute? And information about such
> things as locale settings, encoding and so on, both on your machine
> and in the database?
code are:
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.NVarChar);
// insert a Chinese string into table test(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();
}
}
}
}
create table like :
create table test (name nvarchar2(1000)
my oracle database is 10g, using utf8 for all
my linux is OpenSuSE 10.1, locate is zh_CN.UTF-8
More information about the Mono-devel-list
mailing list