0

I want to fetch multiple records from database using stored procedure. I want to call that procedure from my ASPX application. How it will be possible ??

Any thing that I am trying is as follow:

Oracle Stored Procedure:

CREATE OR REPLACE PROCEDURE GET_DDO
(
  TCODE IN VARCHAR2  
, DDOCODE_var OUT VARCHAR2  
) AS
BEGIN
  select ddocode into ddocode_var from ddo;
END GET_DDO;

My .CS Code:

 myconnection.ConnectionString = conString;
        using (myconnection)
        {
            myconnection.Open();          
            myadapter.SelectCommand = new OleDbCommand("Get_DDO", myconnection);
            myadapter.SelectCommand.CommandType = CommandType.StoredProcedure;
            myadapter.SelectCommand.Parameters.Add("TCode", OleDbType.VarChar).Value = treasuryCode;
            myadapter.SelectCommand.Parameters.Add("DDOCOde",OleDbType.Varchar).Direction=ParameterDirection.Output;
            myadapter.Fill(mydataset);            

            myconnection.Close();

            return mydataset;
        }
1
  • Post the error you're getting? Commented Apr 10, 2012 at 6:53

1 Answer 1

2

You can write multiple select statements in Stored procedure e.g.

Select * from Table1

Select * from Table2

later from database layer you can use DataAdapter to get the values in DataSet e.g.

dataAdapter.Fill(dataSet);

you can get both the recordset in two data tables of dataSet i.e.

dataSet.DataTables[0] // record from Table1

dataSet.DataTables[1] // record from Table2

sorry for the typo mistakes if found.

Sign up to request clarification or add additional context in comments.

2 Comments

But I want to use stored procedure not individual query. Thanks.
you can use stored procedure or query , doesn't matter only you have to change Command Type.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.