Click here to Skip to main content
15,076,991 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i have Prolem ON Stored procedure
C#
OracleCommand cmd = new OracleCommand("insert_category", conn);
    
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("pname", textBox1.Text.ToString());
                cmd.Parameters.AddWithValue("pnote", textBox2.Text.ToString()); 
                
        
      conn.Open();
      cmd.ExecuteNonQuery();
      conn.Close(); 

i have error ORA-06550: line 1 column 7
i need some help
Posted
Comments
Code For You 2-Apr-15 7:22am
   
please give us more detail on the error.
GTR0123 2-Apr-15 7:29am
   
so here is it : ORA-06550: line 1 column 7, PLS - 00306 : wrong number or type of arguments in call 'INSERT_GATEGORY'
ORA-06550: line 1 column 7
pl/sql: statment ignored

Hide Copy Code
procedure insert_category (pname in varchar2, pnote in varchar2, perror out varchar2) is
i number;

begin
perror := null;
select count(*) into i from category where name = pname;
if i > 0 then perror := 'Already Exists'; return; end if;
insert into category (id, name, note)
values (category_seq.nextval, trim(pname), trim(pnote));
commit;
end

<<< this is procedure
anandblitz 2-Apr-15 7:32am
   
Change
<pre lang="c#">cmd.Parameters.AddWithValue("pname", textBox1.Text.ToString());
cmd.Parameters.AddWithValue("pnote", textBox2.Text.ToString()); </pre>
to
<pre lang="c#">cmd.Parameters.AddWithValue("pname", textBox1.Text.ToString()).Value = VAL1;
cmd.Parameters.AddWithValue("pnote", textBox2.Text.ToString()).Value = VAL2;
</pre>
See if this helps.
GTR0123 2-Apr-15 7:37am
   
nothing again same
Sinisa Hajnal 2-Apr-15 7:33am
   
This doesn't seem like C# problem, show stored procedure code. Check the number of parameters. Check the order of the parameters etc...you know, debug. You have output parameter that you're not adding to parameters collection.

Also, put try..catch..finally around database operation(s) and dispose of command and connection objects in finally. Or use "using" block

Please move SP code into the question by using Improve Question link above. Thank you
GTR0123 2-Apr-15 7:38am
   
i have try catch on db connection i have all in 1 so it is connecting to db but :/ then when i am using that procedure it is making this error
Sinisa Hajnal 2-Apr-15 8:35am
   
When you call it directly from SQL Plus or whatever client you use, does it report same error?
GTR0123 2-Apr-15 9:09am
   
nop
Sinisa Hajnal 2-Apr-15 9:51am
   
Did you try adding the output parameter?

Check the number of parameter in the SPROC. It should be exactly match with parameter you are passing from .Net side. Also define the parameter data type while adding the parameter to command object.
   
i tried too much thing so i get :D result it is working :D Ty Guys for help
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900