Command Parameters with direct mode

Command Parameters with direct mode

Postby akrora » Mon 11 May 2009 20:41


I use the standard edition of dotConnect for Oracle and tried the following code once with direct=true in the connection string, and once with direct=false :

OracleConnection con = new OracleConnection(connectionString);


OracleCommand cmd = new OracleCommand();
cmd.Connection = con;

+"select SEQ_T_PROJECT_SESSION.CurrVal into :p0 from DUAL;\n";

cmd.CommandText += "insert into PATENTREPORT.T_TEST_PARAM(PARAM)values(:p0);\n";

cmd.CommandText = "declare\n begin\n" + cmd.CommandText + " end;";

// Parameters

OracleParameter param0 = cmd.CreateParameter();
param0.DbType = System.Data.DbType.Int32;
param0.Direction = System.Data.ParameterDirection.Output;
param0.ParameterName = "p0";
param0.Value = null;

OracleParameter param1 = cmd.CreateParameter();
param1.DbType = System.Data.DbType.String;
param1.Direction = System.Data.ParameterDirection.Input;
param1.ParameterName = "p1";
param1.Value = "user";

OracleParameter param2 = cmd.CreateParameter();
param2.DbType = System.Data.DbType.Date;
param2.Direction = System.Data.ParameterDirection.Input;
param2.ParameterName = "p2";
param2.Value = DateTime.Now;

OracleParameter param3 = cmd.CreateParameter();
param3.DbType = System.Data.DbType.Int32;
param3.Direction = System.Data.ParameterDirection.Input;
param3.ParameterName = "p3";
param3.Value = 847;



The first Insert works fine in both modes. But then it seems that in direct mode the :p0 value is Null after the SELECT INTO statement. With direct=false, the value of this parameter is the correct one (the SEQ_PROJECT_SESSION.Currval).

I red something about a bug with repeated parameters using direct mode ? Is this the problem ?
If it isn't, how can I do to make this code work correctly ?
If this code cannot work in direct mode, is there a possibility to use the Devart assemblies with direct=false but no Oracle Client (for example add the oci.dll in our Deployment, or something like that) ?

The version of dlls I use are :

Thanks in advance for your response.
Posts: 1
Joined: Mon 11 May 2009 20:13

Postby Shalex » Wed 13 May 2009 13:07

I have tried the following code with the 5.20.29 version of dotConnect for Oracle and the version of Oracle server:
Code: Select all
      OracleCommand command = conn.CreateCommand();
      command.CommandText = "insert into table values (1);\n";
      command.CommandText += "select ID_SEQ.CurrVal into :p0 from dual;\n";
      command.CommandText = "begin\n" + command.CommandText + "end;";
      OracleParameter param0 = command.CreateParameter();
      param0.DbType = System.Data.DbType.Int32;
      param0.Direction = System.Data.ParameterDirection.Output;
      param0.ParameterName = "p0";

It works properly (the p0 parameter contains the actual value from the database) in both cases:
in the direct mode and with Oracle client. Please specify the version of Oracle server
you are using and send us (support at devart*com) a small test project that reproduces the problem.
Please include the definitions of database objects and avoid using third-party components.
Devart Team
Posts: 7880
Joined: Thu 14 Aug 2008 12:44

Postby Shalex » Thu 14 May 2009 09:46

We have reproduced the problem. I will post here when the bug is fixed.
Devart Team
Posts: 7880
Joined: Thu 14 Aug 2008 12:44

Postby AndreyR » Thu 14 May 2009 12:30

The issue with repeating parameters of OracleCommand in the Direct mode is fixed.
Look forward to the next build of dotConnect for Oracle that will be available in a week.
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Postby Shalex » Fri 22 May 2009 15:52

The new build of dotConnect for Oracle 5.20.33 is available for download now.
It can be downloaded from (trial version) or from Registered Users' Area (for users with valid subscription only).
For more information, please refer to .
Devart Team
Posts: 7880
Joined: Thu 14 Aug 2008 12:44

Return to dotConnect for Oracle