Oracle and .NET stored procedures returning dataset...

R

Ricardo Magalhaes

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
 
S

Sahil Malik [MVP]

For Oracle, you need to return a REF CURSOR. Rest of the usage remains the
same.
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top