Data Access with oracle function

2 posts, 0 answers
  1. Ruby
    Ruby avatar
    23 posts
    Member since:
    Mar 2012

    Posted 19 May 2014 Link to this post

    I have to use oracle function to populate data in my radgrid.
    My data access function is like code below , it is giving output as cursor

    Public Function ACTIVE_PROMOS() As Integer Implements IEntitiesModelUnitOfWork.ACTIVE_PROMOS
    Dim queryResult As Integer = Me.ExecuteNonQuery("SELECT ""PLUTO"".""INV_ATH"".""ACTIVE_PROMOS""() FROM dual", CommandType.Text)
    Return queryResult
    End Function

    I have use this function as a datasource of my radgrid as attached. Please let me know how to do that
    Protected Sub rgCurrentPromo_NeedDataSource(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles rgCurrentPromo.NeedDataSource
           Using dbContext As New AthenaModel.EntitiesModel()
               Dim query As DataTable()
               dbContext.ACTIVE_PROMOS()
               rgCurrentPromo.DataSource = query
               rgCurrentPromo.DataBind()
           End Using
       End Sub



  2. Boyan
    Admin
    Boyan avatar
    100 posts

    Posted 21 May 2014 Link to this post

    Hello Ruby,

    Oracle functions returning cursors as output are not supported. You could achieve similar functionality using stored procedures that have cursor as an out parameter. You could learn more about this approach from this documentation article.
    Once you have created stored procedures as described in the above documentation article you could use the Domain Method Editor. It should automatically recognize the output cursor parameter scenario and correctly create a domain method.
    Generally you could read more about options available in the Domain Model Editor in this documentation article, but I would like to point your attention to either the Complex Type setting or the Persistent Type setting which might be more suitable for your implementation scenario.
    Once the stored procedure are mapped and invoked as described above, they should return a collection which can later be assigned to be a DataSource.

    Should you have any more question or need further assistance please let us know.

    Regards,
    Boyan
    Telerik
     
    OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
     
  3. DevCraft banner
Back to Top