Home » SQL & PL/SQL » SQL & PL/SQL » .net with stored procedure
.net with stored procedure [message #191369] Wed, 06 September 2006 01:00 Go to next message
selvakumar_82
Messages: 138
Registered: October 2005
Location: chennai
Senior Member
Hi friends,
If any one knows .net with oracle, kindly help me.
anyway i will write my problem in this:

My code was :

procedure proc_item_code(v_item_name varchar2,qty number,price number)
as
out_item_code item_master.item_code%type;
begin
select item_code into out_item_code from item_master where item_name = v_item_name;

insert into purchase_items values (out_item_code,qty,price);
end proc_item_code;

If i exexute from sql*plus its working fine

When i send it from .net its showing error like ,wrong number or type of call to the procedure . I have executed the another procedure with same concept its working fine

My .net code is :

cmd.Connection = conn.conn
cmd.CommandText = "proc_purchase_items"
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.Add(New OracleParameter("v_item", OracleDbType.Varchar2)).Value = cmbitemname.SelectedItem
cmd.Parameters.Add(New OracleParameter("v_qty", OracleDbType.Int32)).Value = TextBox1.Text
cmd.Parameters.Add(New OracleParameter("v_price", OracleDbType.Int32)).Value = TextBox2.Text
cmd.ExecuteNonQuery()
conn.conn.Close()

what are the possiblities to correct this error

Waiting for your valuable reply

thanx and regards
Selva.R
Re: .net with stored procedure [message #191375 is a reply to message #191369] Wed, 06 September 2006 01:32 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
The parameternames in your OracleParameter calls differ from the actual names.

[Edit: I don't speak .Net, but that is the first thing I noticed]

[Updated on: Wed, 06 September 2006 01:33]

Report message to a moderator

Re: .net with stored procedure [message #191397 is a reply to message #191375] Wed, 06 September 2006 02:49 Go to previous messageGo to next message
selvakumar_82
Messages: 138
Registered: October 2005
Location: chennai
Senior Member
No Mr.Frank,
I used like this also,
i have written wrong....correct code is..

cmd.Connection = conn.conn
cmd.CommandText = "proc_purchase_items"
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.Add(New OracleParameter("v_item_name", OracleDbType.Varchar2)).Value = cmbitemname.SelectedItem
cmd.Parameters.Add(New OracleParameter("qty", OracleDbType.Int32)).Value = TextBox1.Text
cmd.Parameters.Add(New OracleParameter("price", OracleDbType.Int32)).Value = TextBox2.Text
cmd.ExecuteNonQuery()
conn.conn.Close()
Re: .net with stored procedure [message #191406 is a reply to message #191397] Wed, 06 September 2006 03:32 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
Int32 is not the type for NUMBER, according to this link. It looks like you should use OracleDbType.Decimal
Re: .net with stored procedure [message #191426 is a reply to message #191406] Wed, 06 September 2006 05:51 Go to previous message
selvakumar_82
Messages: 138
Registered: October 2005
Location: chennai
Senior Member
It is not workinig frank,

I tried with all datatypes it is not working, i think i have learn lot of things in .net then only i can correct this solution.

Thanx man
Previous Topic: Use of DEFAULT in parameter list for spec and body
Next Topic: how to get data from database to excel
Goto Forum:
  


Current Time: Wed Dec 07 10:55:03 CST 2016

Total time taken to generate the page: 0.13900 seconds