Oracle and .NET stored procedures returning dataset...

Discussion in 'ASP .Net' started by Ricardo Magalhaes, Jun 21, 2005.

  1. Hi,

    How can I return a DataSet from oracle stored procedure(that returns for
    example, the customers from Brasil) to my ASP.NET application

    In Sql server is easy.. and seens like this:

    ------------ into sql

    Procedure SP_cursos (@categoriaID Int)

    As

    Select ds_curso from curso where ID_Categoria = @categoriaID

    ------------------------ into my .net class

    Dim dsCursos As New DataSet
    Dim daCurso As New OleDbDataAdapter
    daCurso.SelectCommand = New OleDbCommand
    daCurso.SelectCommand.Connection = objConn
    daCurso.SelectCommand.CommandText = "SP_Cursos"
    daCurso.SelectCommand.CommandType = CommandType.StoredProcedure


    Dim objParam1 As New OleDbParameter("@categoriaID", SQLDBType.Int )
    objParam1.Direction = ParameterDirection.Input
    daCurso.SelectCommand.Parameters.Add(objParam1)

    daCurso.Fill(dsCursos, "cursor")

    ddlMiniCursoOpcao1.DataSource = dsCursos
    ddlMiniCursoOpcao1.DataSource = dsCursos.Tables(0)
    ddlMiniCursoOpcao1.DataTextField =
    dsCursos.Tables(0).Columns("ds_curso").ColumnName.ToString()
    ddlMiniCursoOpcao1.DataValueField =
    dsCursos.Tables(0).Columns("cd_curso").ColumnName.ToString()
    ddlMiniCursoOpcao1.DataBind()

    Best Regards,

    Ricardo Magalhães
     
    Ricardo Magalhaes, Jun 21, 2005
    #1
    1. Advertisements

  2. For Oracle, you need to return a REF CURSOR. Rest of the usage remains the
    same.
     
    Sahil Malik [MVP], Jun 21, 2005
    #2
    1. Advertisements

  3. Thanks Sahil,

    Could you give me some example ?

    Regards
    Ricardo
     
    Ricardo Magalhaes, Jun 21, 2005
    #3
  4. Ricardo Magalhaes

    Paul Clement Guest

    Paul Clement, Jun 21, 2005
    #4
  5. Paul,

    Tanks a lot. It works nice...

    Regards,

    Ricardo Magalhães
     
    Ricardo Magalhaes, Jun 21, 2005
    #5
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.