• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 338
  • Last Modified:

calling a Oracle Stored procedure ASP.net(pls see the following code and help me to find the mistake)



CREATE OR REPLACE PACKAGE PackgeTEST AS
TYPE cursemp IS REF CURSOR RETURN emp%ROWTYPE;
PROCEDURE emptest
(pename IN varchar2, pemp OUT cursemp);
END  PackgeTEST;
/
CREATE OR REPLACE  PACKAGE BODY PackgeTEST AS
PROCEDURE emptest
(pename IN varchar2, pemp OUT cursemp)
AS
BEGIN
Open pemp for Select * from emp where ename = pename;
     END;
     END;
/





public void storedpro()
          {
          string strconn;
          strconn="Data Source= udhanth; User  
                ID=scott;Password=tiger";
          OracleConnection cn= new OracleConnection(strconn);
          cn.Open();
          string strSQL="PackgeTEST.emptest";
          OracleCommand cmd= new OracleCommand(strSQL,cn);
          cmd.CommandType= CommandType.StoredProcedure;
          OracleParameter param;
          param=cmd.Parameters.Add("pename",OracleType.VarChar,10);
          param.Value="KING";
          param=cmd.Parameters.Add("pemp",OracleType.Cursor);
          param.Direction=ParameterDirection.Output;
          OracleDataAdapter da = new OracleDataAdapter(cmd);
          DataSet ds = new DataSet();
          da.Fill(ds);
          DataGrid1.DataSource=ds;
          DataGrid1.DataBind();
          cn.Close();

          }
0
mallasani
Asked:
mallasani
  • 5
  • 2
1 Solution
 
ACGTCommented:
Hi mallasani,

Can you give us the components you are using (Namespace for "OracleCommand??).

We try the same (C# + Oracle db), maybe we can help each other.

Sabine
0
 
mallasaniAuthor Commented:
hello,
i am using microsoft provider for oracle.
using System.Data.OracleClient.
any help is really appreciated, i am having problem with this problem, i'll be happy share whatever i know.
thanks
ramana
0
 
RiverGuyCommented:
The MS Provider for Oracle never worked right for me in VB6.  The Oracle provider worked better.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
ACGTCommented:
Hi mallasani,

tried to follow your code, but my Visual Studio can't find the function:

DataGrid1.DataBind();

If I comment this line and go to end, it works fine and I can explore "table" in the datagrid where I than see the one row with the correct data.

So, what special kind of error do you get?

Sabine
0
 
ACGTCommented:
Sorry, I forgot to mention that I also use the original Oracle Provider and not MS Provider!

Sabine
0
 
ACGTCommented:
Hi Mallasani, are you still living?
Give a sign, if it works now!

Sabine
0
 
mallasaniAuthor Commented:
hi Sabine,
Sorry, I was busy with things, anyway i solved the problem, it was nothing to do with provider, the problem was, the wrong code in the microsoft published book.
thanks though
ramana
0
 
ACGTCommented:
Hi Ramana,

I think, you should accept my comment as answer, as I found exactly the error:
the wrong line in your code.
Would be nice for me and it doesn't hurt you :-)

Sabine
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 5
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now