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!

Fetching a Parameter Object from the Parameters Collection - C#

369622Jan 23 2003 — edited Jan 23 2003
I have been unable to reference a Parameter in the Parameters Collection based up the parameter name. This is most helpful to me to be able to do so as I have a wrapper class that handles my Connection recycling, Command object Creation/Disposal, etc..

The code:

This first piece will Create and set the Parameter and then add it to the Command Object's Parameters Collection.
When it goes to set the Parameter Value, however, it cannot reference it in the Collection based on the Parameter Name.

// Set the Parameter with a String Value, Length Calculated
public void pSet(string ParameterName,
string ParameterDirection,
string ParameterOracleType,
string strParameterValue)
{
OracleParameter oParameter;
int intParameterLength=0;

// length has not been calculated, get a default value
intParameterLength = pLength(ParameterOracleType, ParameterDirection);

// Create the parameter
this.pCreate(ParameterName, ParameterDirection, ParameterOracleType, intParameterLength);
oParameter = cmdODP.Parameters(ParameterName);
oParameter.Value = strParameterValue;
}

What is the difference between the C# implementation and the VB.NET implementation? In VB.NET, I can reference a parameter in the Parameters collection by the Parameter Name or by its index.

Thanks,

Scott Hun;ey
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 20 2003
Added on Jan 23 2003
1 comment
260 views