[Go].net call Oracle stored procedure to return multiple record sets

Source: Internet
Author: User
Tags oracleconnection

CREATE OR REPLACE PROCEDURE P_query_cs (
P_infotype in VARCHAR2,
P_fromareacode in VARCHAR2,
P_toareacode in VARCHAR2,
P_keytype in number,
R_cursor1 out Sys_refcursor,--Result set
R_cursor2 out Sys_refcursor--Result set
)
Is
BEGIN
OPEN R_cursor1 for
SELECT *
From Permit_menu;

OPEN R_cursor2 for
SELECT *
From Permit_privilege;
EXCEPTION
When No_data_found
Then
NULL;
When OTHERS
Then
RAISE;
END P_query_cs;
/


CS Program


UsingSystem.Data.OleDb;
UsingSystem.Data.OracleClient;


ProtectedvoidCS1 ()
{
DataSet ds =NewDataSet ();
using (OleDbConnection conn =New OleDbConnection ("PROVIDER=ORAOLEDB.ORACLE.1; password=***; User id=***;D ata source=***; Persist Security info=true; Plsqlrset=1;"))
{
OleDbCommand Comm =NewOleDbCommand ();
Comm. Connection =Conn
Comm.commandtext ="P_query_cs";
Comm.commandtype =CommandType.StoredProcedure;
OleDbDataAdapter da =NewOleDbDataAdapter (comm);
//Da. TableMappings.Add ("table1", "Permit_menu");
//Da. TableMappings.Add ("Table2", "Permit_privilege");
Da. Fill (DS);
for (Int J =0; J < DS. Tables.count; J + +)
{
for (int i =0; I < DS. TABLES[J]. Rows.Count; i++)
{
for (int k =0; K < DS. TABLES[J]. Columns.count; k++)
{
Response.Write (ds. TABLES[J]. ROWS[I][K]. ToString () +"|");
}
Response.Write ("<br/>");
}
}

}
}


ProtectedvoidCS3 ()
{
OracleConnection conn =New OracleConnection ("Data source=***; User id=***; password=***");
OracleCommand cmd =NewOracleCommand ();
Cmd. Connection =Conn
Cmd.commandtext ="P_query_cs";
Cmd. Parameters.Add ("R_cursor", OracleType.Cursor). Direction =ParameterDirection.Output;
Cmd. Parameters.Add ("R_cursor1", OracleType.Cursor). Direction =ParameterDirection.Output;
Cmd.commandtype =CommandType.StoredProcedure;
OracleDataAdapter da =NewOracleDataAdapter (CMD);
Da. TableMappings.Add ("Table","Permit_menu");
Da. TableMappings.Add ("Table1","Permit_privilege");
DataSet ds =NewDataSet ();
Da. Fill (DS);
for (Int J =0; J < ds. Tables.count; J++)
{
for (int i = 0; I < DS. TABLES[J]. Rows.Count; I++)
{
for (int K = 0; k < ds. TABLES[J]. Columns.count; K++ {
Response.Write (ds. TABLES[J]. ROWS[I][K]. ToString () + "|" );
}
Response.Write ( "<br/> ");
}
}

} /span>

[Go].net call Oracle stored procedure to return multiple recordsets

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.