Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
|
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
 
Old April 18th, 2007, 04:24 AM
Authorized User
 
Join Date: Mar 2006
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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>
 
Old April 18th, 2007, 07:56 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

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
================================================== =========
 
Old April 19th, 2007, 12:31 AM
Authorized User
 
Join Date: Mar 2006
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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





Similar Threads
Thread Thread Starter Forum Replies Last Post
Calling an insert stored proc from a select stored dzitam SQL Language 10 April 2nd, 2007 12:39 PM
MS Access .mdb calling SQL server 2000 stored proc fazzou Access 6 September 8th, 2006 11:32 AM
How to get value from stored proc busybee ASP.NET 1.0 and 1.1 Basics 4 April 2nd, 2006 01:06 AM
Calling a T-SQL Stored proc from DTS mepancha SQL Server 2000 1 April 13th, 2005 09:12 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.