插入某些Unicode字符时参数化查询失败

ved*_*ran 6 .net informix driver

尝试通过参数查询插入某些字符时遇到问题.

当我运行以下查询(不涉及参数)时,一切正常.

string insertQuery = "insert into 'testschema'.texttypestestobject(columnshortstring,columnlongstring)values('¬','test')";
DB2Command myCommand = new DB2Command(insertQuery, conn);
myCommand.ExecuteNonQuery();
Run Code Online (Sandbox Code Playgroud)

但是,如果我像下面这样运行查询,则会失败.

string insertQuery = "insert into 'testschema'.texttypestestobject(columnshortstring,columnlongstring)values(@p0,@p1')";
DB2Command myCommand = new DB2Command(insertQuery, conn);
myCommand.Parameters.Add(new DB2Parameter("@p0", "¬"));
myCommand.Parameters.Add(new DB2Parameter("@p1", "test"));
myCommand.ExecuteNonQuery();
Run Code Online (Sandbox Code Playgroud)

错误是:

Executing Sql 'insert into 'testschema'.texttypestestobject(columnshortstring,columnlongstring)values(@p0,@p1)'
with parameters '{¬},{ test}' exception 'IBM.Data.DB2.DB2Exception (0x80004005):
ERROR [IX000] [IBM][IDS/NT64] Code-set conversion function failed due to illegal
sequence or invalid value.
Run Code Online (Sandbox Code Playgroud)

已安装Informix服务器11.70(64位)和Client SDK 3.50,并且正常运行.使用en_US.utf8或cs_CZ.8859-2创建数据库.

失败的一个字符是'¬'(Unicode 172).

有没有人见过这个错误?可能是什么原因?是否需要在驱动程序上执行一些其他配置?

ved*_*ran 3

我收到了 ibm 开发者论坛的回复。这是一个错误,已使用最新的修复包修复。

可以通过安装修订包或设置环境变量 DB2CODEPAGE=1208 来解决

https://www.ibm.com/developerworks/forums/thread.jspa?messageID=14779728蕐