Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Fill Dataset/DataReader (C#) from StoredProcedure??

520094Dec 31 2006 — edited Jan 14 2007
derekmallard@hotmail.com

Dear ODP Friends,

I’ve used following Stored Procedure.
I’m using Dot Net(C#)I and want to Fill Dataset or Data reader.
Could some one be able to through the lights how to fill dataset or datareader from a storedprocedure.
Any idea would be valuable.

/*************************************************SQL,PL/SQL********************************************/
SQL> conn
Enter user-name: scott
Enter password: *****
Connected.
SQL> create or replace PROCEDURE Test
(
or_cursr out sys_refcursor
)
as
BEGIN
OPEN or_cursr FOR
SELECT * FROM Scott.Emp Where Empno=7788;
END Test;
/

Procedure created.

/**********************IN DOT NET(C#)*********************************/
Try
{
con.Open();
OracleCommand cmd = new OracleCommand("Test", con);
cmd.CommandType = CommandType.StoredProcedure;

DataSet ds = new DataSet();
OracleDataAdapter adptr=new OracleDataAdapter();
adptr.SelectCommand = cmd;
adptr.Fill(ds); //Here Error found.
MessageBox.Show(“Data set filled.”);
}
catch(OracleException ex){ MessageBox.Show(“Oracle Error\n”+ex.Message); }
catch (Exception ex) { MessageBox.Show(“General App Error”); }
finally
{
con.Close()
}

//**********************//
Error is :

Ora-06550: line 1, column 7:
PLS-00306: wrong Number or types of argument in call to ‘TESt’
Ora-06550: line 1, column 7:

Pl/Sql: statement ignored


Khurram
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 11 2007
Added on Dec 31 2006
4 comments
16,236 views