Inserting a value to a CLOB column using .NET base classes

Inserting a value to a CLOB column using .NET base classes

Postby jmangelo » Mon 21 Apr 2008 09:49

Hello, I'm using OraDirect v4.50 and I would like to know if its possible to insert/update values of a CLOB column using only the .NET base classes (DbConnection, DbCommand, DbParameter) and the enumeration DbType.

With Direct=true on the connection string I'm getting the following error:
"ORA-01460: unimplemented or unreasonable conversion requested"

Not using direct connection I get the error:
"ORA-01461: can bind a LONG value only for insert into a LONG column"

Example:
Code: Select all
string sqlCmd;
// txt is the CLOB column
sqlCmd = "INSERT INTO T_CLOB (id, txt) VALUES (:id, :text)";

DbCommand cmd = dbConnection.CreateCommand();

cmd.CommandText = sqlCmd;

string longText = new String('x', 6000);

cmd.Parameters.Add(":id", 1);
cmd.Parameters.Add(":text", longText);

cmd.ExecuteNonQuery();


Thanks,
João Angelo
jmangelo
 
Posts: 2
Joined: Mon 25 Feb 2008 11:51

Postby Alexey.mdr » Mon 21 Apr 2008 10:59

Hello!

Unfortunately, it's not possible to insert/update values of a
CLOB column using only the .NET base classes.
Because DbType enumeration doesn't have the one type that strictly corresponds to Oracle CLOB type.
But still you can make your own middle tier that will recognize the .NET type and convert it to the required Oracle type.
Alexey.mdr
 
Posts: 729
Joined: Thu 13 Dec 2007 10:24


Return to dotConnect for Oracle