M
MartinKK
Hi all,
I have a problem with converting OracleDbType.Decimal to System.Decimal. I
have the following code:
....(class)
public decimal speed;
OracleCommand cmd = new OracleCommand("GETNORM", dataCa.connection);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("return", OracleDbType.Int32).Direction =
ParameterDirection.ReturnValue;
cmd.Parameters.Add("CODE", OracleDbType.Decimal).Value = idSubject;
cmd.Parameters.Add("OUTSPEED", OracleDbType.Decimal).Direction =
ParameterDirection.Output;
cmd.ExecuteNonQuery();
this.speed = (Decimal)cmd.Parameters["OUTSPEEDVALUE"].Value;
....
The last line causes runtime error: Specified type-cast is invalid (I'm
translating from Czech language). In VS2008 debug I see, that
"cmd.Parameters["OUTSPEEDVALUE"].Value" has value (OUTSPEEDVALUE = 62).
My question is: How can I assign value from Oracle parameter to .NET (C#)
variable.
I'm unhappy 2 days.
Thanks
Martin
I have a problem with converting OracleDbType.Decimal to System.Decimal. I
have the following code:
....(class)
public decimal speed;
OracleCommand cmd = new OracleCommand("GETNORM", dataCa.connection);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("return", OracleDbType.Int32).Direction =
ParameterDirection.ReturnValue;
cmd.Parameters.Add("CODE", OracleDbType.Decimal).Value = idSubject;
cmd.Parameters.Add("OUTSPEED", OracleDbType.Decimal).Direction =
ParameterDirection.Output;
cmd.ExecuteNonQuery();
this.speed = (Decimal)cmd.Parameters["OUTSPEEDVALUE"].Value;
....
The last line causes runtime error: Specified type-cast is invalid (I'm
translating from Czech language). In VS2008 debug I see, that
"cmd.Parameters["OUTSPEEDVALUE"].Value" has value (OUTSPEEDVALUE = 62).
My question is: How can I assign value from Oracle parameter to .NET (C#)
variable.
I'm unhappy 2 days.
Thanks
Martin