 |
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|

April 18th, 2007, 04:24 AM
|
Authorized User
|
|
Join Date: Mar 2006
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Calling Stored Proc with OUT params
Hi ALl,
I'm trying to call a Stored Proc to insert a few values and retrun the autogenerated Key. But m getting n error 'wrong number or types of arguments ' ...
The code which is used to call the proc is below:
The Proc:
Code:
CREATE OR REPLACE PROCEDURE InsertRec (
pk out table1.pr_key%TYPE,
errCode out int,
arg_ID table1.ID%TYPE
)
The C# code:
Code:
OracleConnection conn = new OracleConnection();
conn.ConnectionString = ConfigurationManager.ConnectionStrings["Data"].ConnectionString;
conn.Open();
OracleTransaction transaction = conn.BeginTransaction();
OracleCommand addRec = conn.CreateCommand();
addRec.CommandType = CommandType.StoredProcedure;
addRec.Transaction = transaction;
addRec.CommandText = "InsertRec";
OracleParameter myParameter1 = new OracleParameter("pk", OracleType.Int32);
myParameter1.Direction = ParameterDirection.Output;
OracleParameter myParameter2 = new OracleParameter("insertError", OracleType.Int32);
myParameter2.Direction = ParameterDirection.Output;
OracleParameter myParameter4 = new OracleParameter("ID", OracleType.Int32);
myParameter3.Value = -2;
myParameter3.Direction = ParameterDirection.Input;
addRec.Parameters.Add(myParameter1);
addRec.Parameters.Add(myParameter2);
addRec.Parameters.Add(myParameter3);
addRec.ExecuteNonQuery();
------------------------------------------------------------------------------------------------------------
Adventure, Play, Alive, Fast, Race, Addict, React, Attack, Heat, Aggression, Blast, Ahead, Escape, Challenge, Anarchy, Game, Real, Damage, Insane, Acclerate,Passion, Fear, Dominate, Crazy, Awesome, Sweat, Habit, Avenge, Balls, Imagine, Viril, Chaos, Amuse, Heavy, Panic, @#!%, Fanatic
__________________
------------------------------------------------------------------------------------------------------------
<b><i>Adventure, Play, Alive, Fast, Race, Addict, React, Attack, Heat, Aggression, Blast, Ahead, Escape, Challenge, Anarchy, Game, Real, Damage, Insane, Acclerate,Passion, Fear, Dominate, Crazy, Awesome, Sweat, Habit, Avenge, Balls, Imagine, Viril, Chaos, Amuse, Heavy, Panic, @#!%, Fanatic </i></b>
|

April 18th, 2007, 07:56 AM
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
|
|
hi there.. names of the parameters differs than that in the SP.. that could be the issue???
HTH
Gonzalo
================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
|

April 19th, 2007, 12:31 AM
|
Authorized User
|
|
Join Date: Mar 2006
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Man .. how i overlooked it ... thanx .. dude
------------------------------------------------------------------------------------------------------------
Adventure, Play, Alive, Fast, Race, Addict, React, Attack, Heat, Aggression, Blast, Ahead, Escape, Challenge, Anarchy, Game, Real, Damage, Insane, Acclerate,Passion, Fear, Dominate, Crazy, Awesome, Sweat, Habit, Avenge, Balls, Imagine, Viril, Chaos, Amuse, Heavy, Panic, @#!%, Fanatic
|
|
 |