Trying to insert into a table (Text Column) via Dapper, and getting the error from Informix:
Illegal attempt to use Text/Byte host variable
I have written a small program to simulate this, and I am still up against problems.
We cannot currently use the Informix drivers, as they do not suit our needs.
using Dapper;
using System;
using System.Data.Odbc;
namespace DapperParamsTest
{
class Program
{
static void Main(string[] args)
{
OdbcConnection conn = new System.Data.Odbc.OdbcConnection("Driver={IBM INFORMIX ODBC DRIVER (64-bit)}; Host=bylgia; Server=bylgia; Service=sqlexec; Protocol=onsoctcp; Database=DATABASE; Client_Locale=en_US.CP1252; DB_LOCALE=en_GB.1252");
var dynParams = new DynamicParameters();
dynParams.Add("np_c_ref",-1);
dynParams.Add("np_np_type","T");
dynParams.Add("np_text", System.Text.Encoding.Default.GetBytes("TEXT INPUT"), System.Data.DbType.Binary);
conn.Execute("INSERT INTO notepads (np_c_ref, np_type,np_text) VALUES (?,?,?)",dynParams);
Console.WriteLine("Written");
Console.ReadLine();
}
}
}
Table Structure:
CREATE TABLE notepad
(
np_c_ref int,
np_type char(1),
np_text TEXT
)