all groups > vb.net data > october 2005 >
You're in the

vb.net data

group:

Question about parameters to SP



Re: Question about parameters to SP William (Bill) Vaughn
10/24/2005 10:19:01 AM
vb.net data: Just a guess (I'm no Oracle wiz), try setting the direction of the first
Parameter to Output instead of ReturnValue.

hth

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

[quoted text, click to view]

Question about parameters to SP Tom Rahav
10/24/2005 7:01:35 PM
Hello!

I have the following SP (Oracle):

************************************************************************************************
CREATE OR REPLACE PROCEDURE openorder (ordernum out number ,orderdate in
date ,clinetnum IN NUMBER)
IS
begin
INSERT INTO ORDERS (ORDER_NUM, CLIENT_NUM,ORDER_DT , STATUS)
VALUES (ORDER_SEQ.NEXTVAL , clinetnum, orderdate, 'open');
select ORDER_SEQ.CURRVAL into ordernum from ORDERS ;
commit;
end openorder ;
/
************************************************************************************************

Can someone please tell me how do I use this SP (sending parameters and
getting the result back?
I tried the following code, but I get error message ("worong number or types
of arguments..."):

cn.Open()
Dim cmd As New OracleCommand("openorder", cn)

cmd.CommandType = CommandType.StoredProcedure

cmd.Parameters.Add(New OracleParameter("ordernum", OracleDbType.Int16,
ParameterDirection.ReturnValue))

cmd.Parameters.Add(New OracleParameter("orderdate", OracleDbType.Date,
ParameterDirection.Input)).Value = DateTime.Parse("6/3/2003 8:00 AM")

cmd.Parameters.Add(New OracleParameter("clinetnum", OracleDbType.Int16,
ParameterDirection.Input)).Value = 2

Dim dr As OracleDataReader = cmd.ExecuteReader()

Doesn't work... :(
Thanks!
Tom.

AddThis Social Bookmark Button