Fill Dataset/DataReader (C#) from StoredProcedure??
520094Jan 13 2007 — edited Jan 15 2007Dear 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