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!

OracleDbType.??? vs. OracleType.Number

409776Nov 24 2003 — edited Nov 24 2003
I'm converting a C#/.NET application to use ODP .NET.

All the other data types coverted from the OracleType to the OracleDbType work except for the two instances where I'm dealing with what were OracleType.Number parameters.

The documentation I can find on ODP .NET states that I should be able to use OracleDbType.Number, but when I put that into to code, Visual Studio .NET 2003 gives me the error that "'Oracle.DataAccess.Client.OracleDbType' does not contain a definition for 'Number'".

Previously the following code snippet worked:

.
.
.
using System.Data.Oracle.Client;
.
.
.
try
{
OracleCommand cmd = new OracleCommand(
"UPDATE challenge_response " +
"SET tier = :tier " +
"WHERE mnet_id = (SELECT mnet_id FROM mnet_data WHERE cuid = upper(:cuid))", oConn, trans);

OracleParameter pi_cuid = new OracleParameter("cuid", OracleType.VarChar, 8);
OracleParameter pi_tier = new OracleParameter("tier", OracleType.Number, 1);

pi_cuid.Direction = ParameterDirection.Input;
pi_tier.Direction = ParameterDirection.Input;

pi_cuid.Value = cuid.Trim();
pi_tier.Value = tier;

cmd.Parameters.Add(pi_cuid);
cmd.Parameters.Add(pi_tier);

cmd.ExecuteNonQuery();

trans.Commit();

ret = true;
}
.
.
.

Currently the following modified code snippet says it works [does not return an exception on the cms.ExecuteNonQuery(); line], but does not actually update the database:

.
.
.
using Oracle.DataAccess.Client;
using Oracle.DataAccess.Types;
.
.
.
try
{
OracleCommand cmd = new OracleCommand(
"UPDATE challenge_response " +
"SET tier = :tier " +
"WHERE mnet_id = (SELECT mnet_id FROM mnet_data WHERE cuid = upper(:cuid))", oConn);

OracleParameter pi_cuid = new OracleParameter("cuid", OracleDbType.Varchar2, 8);
OracleParameter pi_tier = new OracleParameter("tier", OracleDbType.Int32);

pi_cuid.Direction = ParameterDirection.Input;
pi_tier.Direction = ParameterDirection.Input;

pi_cuid.Value = cuid.Trim();
pi_tier.Value = tier;

cmd.Parameters.Add(pi_cuid);
cmd.Parameters.Add(pi_tier);

cmd.ExecuteNonQuery();

trans.Commit();

ret = true;
}
.
.
.

I've tried OracleDbType.Int16, Int32, Int64, Decimal, Double, Single, Float ... all in trying to get the process to properly update. All with and without adding the parameter size (1) to the OracleParamenter line for tier.

Any suggestions are welcome!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 22 2003
Added on Nov 24 2003
4 comments
24,951 views