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!

About procedure output paramater in VB.NET

787284Jul 25 2010 — edited Aug 7 2010
sorry,my English is pool.
I'm building ASP.net Project on opt.net.At first I created procedure in oracle10g Database,the code is:

CREATE OR REPLACE PROCEDURE DirectRunning(currentDateTime date,MaxDateTime out Date) as
BEGIN
SELECT MAX(updatetime) INTO MaxDateTime
FROM mytable
WHERE updatetime < to_date(currentDate,'yyyy-mm-dd hh24:mi:ss')
AND updatetime > to_date(sysdate);
END;

I want to compute MaxDateTime is Large than today 0:00 (such as "2010-07-25 0:00:00") and less than
today's current time (such as "2010-07-25 18:25:24").

I used VB.Net language on visual studio 2008, my OPT.NET version is 11gRelease(11.1.0.7.20).

my VB.NET code is:

Imports Oracle.DataAccess.Client
Imports Oracle.DataAccess.Types
Imports System.Configuration

Partial Public Class _Default
Inherits System.Web.UI.Page

dim conn as OracleConnenction = nothing

Protected Sub Page_Load(Byval sender as object,byval e as System.EventArgs) Handles Me.load

conn=new oracleConnection(ConfigurationManager.ConnectionString("myConnStr").ConnectionString)

Using conn
dim command as new oraclecommand("DirectRunning",conn)
command.commandType=CommandType.StoreProcedure

dim parmCurrentDateTime as new OracleParameter("currentDateTime",OracleDbType.Date,ParameterDirection.Input)
parmCurrentDateTime.Value=DateTime.now

dim ParmMaxDateTime as New OracleParameter("MaxDateTime",OracleDbType.Date,ParameterDirection.Output)

command.Parameters.add(parmCurrentDateTime)
command.Parameters.add(ParmMaxDateTime )

command.ExecuteNonQuery ' This is Error:ORA-1843,Not a valid month problem

me.myLable.text=ParmMaxDateTime.value

End Using

End Sub

What's wrong ? How I do...? And how to use Oracle.DateAccess output Parameter?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 4 2010
Added on Jul 25 2010
4 comments
2,430 views