locked
ODP.NET - How to install? RRS feed

  • Question

  • User-1104215994 posted

    Hi,

    I would like to use ODP.NET in order to see if I can use "SELECT FOR UPDATE" statement. How can I install and use this data provider???

    Best Regards.

    Thursday, August 4, 2011 8:35 AM

Answers

  • User269602965 posted

    Software.  On installation prompts install the DATABASE installation to the database server

    and install the CLIENT installation to the web/application server.

    Read the documentation first to avoid problems as first time user.

    http://www.oracle.com/technetwork/developer-tools/visual-studio/downloads/index.html

    developers guides

    http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10767.pdf

    http://download.oracle.com/docs/cd/E11882_01/win.112/e18754.pdf

    select, update, insert, delete can be done from ASP.NET page, code behind page, or call to Oracle Stored Procedure.

    Example of calling stored procedure:

     

    VB.NET code in ASP.NET application
    
        ' Get data from stored procedure '
        Try
          Dim connstr As String = ConfigurationManager.ConnectionStrings("{OracleConnectionStringNameFromWebConfig}").ConnectionString
          Using conn As New OracleConnection(connstr)
            Using cmd As New OracleCommand("{SCHEMANAME}.{PACKAGENAME}.rcSelectCountContracts", conn)
              cmd.CommandType = CommandType.StoredProcedure
              cmd.Parameters.Clear()
              cmd.Parameters.Add("CountContracts", OracleDbType.RefCursor, ParameterDirection.Output)
              conn.Open()
              Using oda As New OracleDataAdapter(cmd)
                Dim ds As New DataSet()
                oda.Fill(ds)
                Me.RadGrid1.MasterTableView.DataSource = ds.Tables(0)
              End Using
            End Using
          End Using
        Catch ex As Exception
        End Try
    
    Oracle PL/SQL code
        
    CREATE OR REPLACE PACKAGE {SCHEMANAME}.{PACKAGENAME} AS TYPE refCursor IS REF CURSOR;
      PROCEDURE rcSelectCountContracts(CountContracts OUT refCursor);
    END {PACKAGENAME};
    /
    
    CREATE OR REPLACE PACKAGE BODY {PACKAGENAME} AS
    
    PROCEDURE rcSelectCountContracts(CountContracts OUT refCursor)
    IS
    BEGIN
      OPEN CountContracts FOR
        SELECT PRODUCT_CLASS, AMOUNT_ANNUAL_CONTRACT, COUNT, TOTAL_VALUE FROM {SCHEMANAME}.VW_COUNT_CONTRACTS;
    END;
    
    END {PACKAGENAME};
    /
    
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, August 4, 2011 9:56 AM