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!

Error: Conversion from type 'OracleDecimal' to type 'Integer' is not valid.

671325Aug 6 2009 — edited Aug 11 2009
Hi ,

I am trying to migrate my Asp.net application from using Microsoft's System.Data.OracleClient to Oracle's ODP.
Because I heard that Microsoft's is going to deprecate System.Data.OracleClient .

With the below, I have Included both the Asp.net codebehind with error and the Oracle Stored procedure that is used. Please advise me correct it.


Asp.net codebehind with error:

Imports Oracle.DataAccess.Client
Imports Oracle.DataAccess.Types
Imports System.Data
Imports System.Web.UI.HtmlControls

Partial Class WebPageCodeBehind
Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

Conn.ConnectionString = ConfigurationManager.ConnectionStrings("MyConnection").ConnectionString

Conn.Open()

Dim Oracle_Command As OracleCommand

Oracle_Command = New OracleCommand("USP_USER_AUTH", Conn)
Oracle_Command.CommandType = CommandType.StoredProcedure

Oracle_Command.Parameters.Add("P_USER", OracleDbType.Char)
Oracle_Command.Parameters("P_USER").Direction = ParameterDirection.Input

Oracle_Command.Parameters.Add("P_RESULT", OracleDbType.Int32)
Oracle_Command.Parameters("P_RESULT").Direction = ParameterDirection.Output

Oracle_Command.ExecuteNonQuery()

Dim Result_Status As Integer
Result_Status = Oracle_Command.Parameters("P_RESULT").Value ==> Error: Conversion from type 'OracleDecimal' to type 'Integer' is not valid._
Conn.Dispose()

End Sub

End Class
=====================================================================================

Oracle Stored Procedure:

PROCEDURE "EARMARK"."USP_USER_AUTH" ( P_USER IN VARCHAR2, P_RESULT OUT NUMBER) IS

BEGIN
SELECT
COUNT(*)
INTO
P_RESULT
FROM
USERID
WHERE
UPPER(trim(USER_ID)) = UPPER(trim(P_USER));
END IF;

END "USP_USER_AUTH";
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 8 2009
Added on Aug 6 2009
25 comments
15,844 views