Skip to Main Content

ODP.NET

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Bug with TableAdapter Code generation

485900Jun 7 2006 — edited Jul 21 2006
I believe I found a bug with the ODP.NET beta adapter.
I am using VS2005, C#.
When calling a stored procedure a refcursor must be returned in order to return a result set. If you set the select command of a table adapter to a stored procedure and add an out parameter and mark it as a RefObject. The auto generated code lookes like this:

private void InitCommandCollection() {
this._commandCollection = new Oracle.DataAccess.Client.OracleCommand[1];
this._commandCollection[0] = new Oracle.DataAccess.Client.OracleCommand();
this._commandCollection[0].Connection = this.Connection;
this._commandCollection[0].CommandText = "SPC_USERS_LIST";
this._commandCollection[0].CommandType = System.Data.CommandType.StoredProcedure;
Oracle.DataAccess.Client.OracleParameter param = new Oracle.DataAccess.Client.OracleParameter();
param.ParameterName = "BITSHOWALL";
param.DbType = System.Data.DbType.Byte;
param.Size = 22;
param.IsNullable = true;
param.SourceColumn = null;
this._commandCollection[0].Parameters.Add(param);
param = new Oracle.DataAccess.Client.OracleParameter();
param.ParameterName = "RCT1";
param.DbType = System.Data.DbType.Object;
param.Direction = System.Data.ParameterDirection.Output;
param.IsNullable = true;
param.SourceColumn = null;
this._commandCollection[0].Parameters.Add(param);
}

When you call Fill you get a bind error from Oracle.
What the code needs to be is this:

private void InitCommandCollection() {
this._commandCollection = new Oracle.DataAccess.Client.OracleCommand[1];
this._commandCollection[0] = new Oracle.DataAccess.Client.OracleCommand();
this._commandCollection[0].Connection = this.Connection;
this._commandCollection[0].CommandText = "SPC_USERS_LIST";
this._commandCollection[0].CommandType = System.Data.CommandType.StoredProcedure;
Oracle.DataAccess.Client.OracleParameter param = new Oracle.DataAccess.Client.OracleParameter();
param.ParameterName = "BITSHOWALL";
param.DbType = System.Data.DbType.Byte;
param.Size = 22;
param.IsNullable = true;
param.SourceColumn = null;
this._commandCollection[0].Parameters.Add(param);
param = new Oracle.DataAccess.Client.OracleParameter();
param.ParameterName = "RCT1";
param.OracleDbType = Oracle.DataAccess.Client.OracleDbType.RefCursor;
param.Direction = System.Data.ParameterDirection.Output;
param.IsNullable = true;
param.SourceColumn = null;
this._commandCollection[0].Parameters.Add(param);
}

Comments

Processing
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Aug 18 2006
Added on Jun 7 2006
6 comments
2,887 views