Oracle parameter not supported

Oracle parameter not supported

Postby bclayshannon » Thu 15 Mar 2012 17:07

I'm getting the err msg:

System.ArgumentException was unhandled
Message=Value with type Devart.Data.Oracle.OracleParameter not supported.

...with this code that is trying to execute a Stored Proc:

Code: Select all
OracleParameter pRes = new OracleParameter("C_REF", OracleDbType.Cursor);
            pRes.Direction = ParameterDirection.ReturnValue;

            int iFromYear = dateTimePickerFrom.Value.Year;
            int iFromMonth = dateTimePickerFrom.Value.Month;
            int iFromDay = dateTimePickerFrom.Value.Day;
            int iToYear = dateTimePickerTo.Value.Year;
            int iToMonth = dateTimePickerTo.Value.Month;
            int iToDay = dateTimePickerTo.Value.Day;
            oracleCommand1.Parameters.Add("iStartDate", new DateTime(iFromYear, iFromMonth, iFromDay));
            oracleCommand1.Parameters.Add("iEndDate", new DateTime(iToYear, iToMonth, iToDay));
            oracleCommand1.Parameters.Add("iCATEGORYID", 114);
            oracleCommand1.Parameters.Add("c_ref", pRes);

Can anybody see what the problem is?
Posts: 29
Joined: Wed 14 Mar 2012 18:37
Location: Monterey, California

A possible clue

Postby bclayshannon » Thu 15 Mar 2012 17:12

When I look at pres while debugging (before hitting the ExecuteCursor() line that makes it crash), I see that pres has null values for ObjectTypeName, OracleValue, and Value...
Posts: 29
Joined: Wed 14 Mar 2012 18:37
Location: Monterey, California

Postby Pinturiccio » Tue 20 Mar 2012 08:26

There is no overloaded method OracleCommand.Parameters.Add(string, OracleParameter). When you use such signature for this method, it tries to use OracleCommand.Parameters.Add(string parameterName, object value). But value parameter can has OracleParameter type.
If you want to add an existing parameter to a collection, then use the following code:
Code: Select all
Devart Team
Posts: 1928
Joined: Wed 02 Nov 2011 09:44

Return to dotConnect for Oracle