keyongtech


  keyongtech > data.* > data.ado > 11/2006

 #1  
11-14-06, 03:00 PM
eny
Hi all

I'm tryng to use MSDAORA access in a Oracle 9 database.
I have a stored procedure named TEST with this Sign :
PROCEDURE TEST
(
PC_01 IN VARCHAR2
,PC_02 IN VARCHAR2
,PO_01 OUT INTEGER
,PO_02 OUT VARCHAR2
)

....
i'have a button that start the store:

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
'con oracle:
Dim conn As New System.Data.OracleClient.OracleConnection
conn.ConnectionString = "Data Source=port22;Persist Security
Info=True;User ID=cont_amm;Password=cont_amm;Unicode=True"
conn.Open()
Dim sql As String = "TEST"
Dim cmd As New OracleCommand(sql, conn)
cmd.CommandType = CommandType.StoredProcedure
Dim Par_01 As New OracleParameter("STPAR01", OracleType.VarChar)
Par_01.Size = 400
Par_01.Value = CType("ZZZZZZ", System.Data.OracleClient.OracleString)
cmd.Parameters.Add(Par_01)
Dim Par_02 As New OracleParameter("STPAR02", OracleType.VarChar)
Par_02.Value = "YYYYYY"
cmd.Parameters.Add(Par_02)
Dim Par_03 As New OracleParameter("STPAR03", OracleType.Number)
Par_03.Direction = ParameterDirection.Output
cmd.Parameters.Add(Par_03)
Dim Par_04 As New OracleParameter("STPAR04", OracleType.VarChar)
Par_04.Direction = ParameterDirection.Output
Par_04.Size = 3000
cmd.Parameters.Add(Par_04)
Try
Dim dr As OracleDataReader = cmd.ExecuteScalar
Catch et As OracleException
Dim errorMessage As String = "Code: " & et.Code & vbCrLf & _
"Message: " & et.Message
Label2.Text = errorMessage
End Try
conn.Close()
End Sub
End Class

i cath the exception:
Code: 6550
Message: ORA-06550: line1, column 7:
PLS-00306: wrong number of types of arguments in call to 'TEST'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
I'm not sure about cmd.ExecuteScalar

do I miss anything? please help and advise... thanks!
 #2  
11-14-06, 03:34 PM
Stephen Howe
> Dim dr As OracleDataReader = cmd.ExecuteScalar

This line means you are using ADO.NET and not ADO as classic ADO's Command
OBject does not have a ExecuteScalar method. This newsgroup discusses
classic ADO (on-topic) and not ADO.NET (off-topic)

If you want help with ADO.NET, read below:

All .NET newsgroup have the word "dotnet" somewhere within.
If a newsgroup does not have "dotnet" then it is not for .NET support

See

Newsgroup support on .NET:
microsoft.public.dotnet.* hieracrchy

Newsgroup support on ADO.NET:
microsoft.public.dotnet.framework.adonet

Newsgroup support on VB.NET:
microsoft.public.dotnet.framework.languages.vb
microsoft.public.dotnet.framework.languages.vb.con trols
microsoft.public.dotnet.framework.languages.vb.dat a
microsoft.public.dotnet.framework.languages.vb.upg rade

Newsgroup support on C#:
microsoft.public.dotnet.framework.languages.csharp

Newsgroup support on Datagrid:
microsoft.public.dotnet.framework.aspnet.datagridc ontrol

Newsgroup support on Datatools:
microsoft.public.dotnet.datatools

Newsgroup support on Windows Forms
microsoft.public.dotnet.framework.windowsforms
microsoft.public.dotnet.framework.windowsforms.con trol
microsoft.public.dotnet.framework.windowsforms.dat abinding

Stephen Howe
 #3  
11-14-06, 03:39 PM
Bob Barrows [MVP]
eny wrote:
> Hi all
>
> I'm tryng to use MSDAORA access in a Oracle 9 database.
> I have a stored procedure named TEST with this Sign :
> PROCEDURE TEST
> (
> PC_01 IN VARCHAR2
> ,PC_02 IN VARCHAR2
> ,PO_01 OUT INTEGER
> ,PO_02 OUT VARCHAR2
> )
>
> ...
> i'have a button that start the store:
>
> Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles Button2.Click
> 'con oracle:
> Dim conn As New System.Data.OracleClient.OracleConnection


There was no way for you to know it (except maybe by browsing through
some of the previous questions in this newsgroup before posting yours -
always a recommended practice) , but this is a classic ADO newsgroup.
ADO.Net bears very little resemblance to classic ADO so, while you may
be lucky enough to find a dotnet-knowledgeable person here who can
answer your question, you can eliminate the luck factor by posting your
question to a group where those dotnet-knowledgeable people hang out. I
suggest microsoft.public.dotnet.framework.adonet.

However, is this the correct datatype to use for an INTEGER parameter?
Similar Threads
SQL Server stored procedure output parameters.

Hello. I'm having difficulty getting the value of output parameters from stored procedures on a SQL server. I understand that this just doesn't work with odbc so I've tried...

Using Stored Procedure at sqlDataAdapters with output parameters

declare @Count int select @Count = COUNT ( * ) FROM tblXUDUserShip select FirstName,SurName,@Count AS BankaSayisi FROM tblXUDUserShip I have a Stored Procedure Which...

Getting OUTPUT parameters from another stored procedure

OK, here is what I have. Proc1 defines some variables within it, say one is @Amount1 and @Amount2. (These are not parameters passed to proc1, they are variables within...

Output Parameters set by Stored procedure

HI, Trying to set a Global Variable using output from a stored procedure. I'm using a row value. The stored procedure variable is declared as varchar(200). The Global...

Stored Procedure Output Parameters

I have a Stored procedure in SQL, that works, when tested in SQL, with one input & several output parameters, as follows: CREATE PROCEDURE myProcedure @MyID int , @First...


All times are GMT. The time now is 06:51 PM. | Privacy Policy