This is a migrated thread and some comments may be shown as answers.

Stored Procedure Forward Mapping

4 Answers 93 Views
Getting Started
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Joebet
Top achievements
Rank 1
Joebet asked on 23 Jun 2010, 08:13 AM
Good day this is my second thread for the day. May I ask if how can I forward map a stored procedure or views in a fly? just like forward mapping a database table that is very easy to do using the wizard. Also is it possible to make a class stored procedure without the actual stored procedure present in the database? That is, my stored procedure is the actual class in my application.

tnx

4 Answers, 1 is accepted

Sort by
0
Joebet
Top achievements
Rank 1
answered on 24 Jun 2010, 02:41 AM
anyone pls?
0
Ady
Telerik team
answered on 24 Jun 2010, 01:54 PM
Hello Joebet,

 You can let OpenAccess create the stored procedures required for INSET,UPDATE or DELTE operations on a table. This can be done by specifying certain mapping the app.config file. The Forwrad Mapping UI for this is currently not available. You can find details of how to achieve this, here.
It is not possible to forward map/create views at the moment.

I did not understand the last question about the StoredProcedure class. The Reversemapping wizard creates this class with static methods to execute existing stored procedures. You can manually write such a class and use the 'IObjectScope.GetSqlQuery' method to execute your stored procedures.

Do get back to us in case you have further questions.

Kind regards,
Ady
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Joebet
Top achievements
Rank 1
answered on 25 Jun 2010, 02:53 AM
Hi Ady,
Thanks for the reply. I will simplify my second question. Can I Forward map a stored procedure written in my class during runtime? Because what I am trying to accomplish is to create a database with all of the objects using telerik in runtime.. that is, I already had made my classes and stored procedures to form a table and stored procedures (views not included because as what you had said it is not yet supported) once the runtime forward mapping takes into action. My sample stored procedure can be found below. again can i forward map this stored procedures during runtime? 

Sorry for my bad english.. 
Tnx


Public Class StoredProcedure 
 
    Public Shared Function UpdateSupplier(ByVal scope As IObjectScope,ByVal m_Counter As String,ByVal m_FirstName As String,ByVal m_MiddleName As String,ByVal m_LastName As String) As IQueryResult 
        Dim query As IQuery = scope.GetSqlQuery("[UpdateSupplier] ?,?,?,?", Nothing, "LONGVARCHAR m_Counter,LONGVARCHAR m_FirstName,LONGVARCHAR m_MiddleName,LONGVARCHAR m_LastName") 
        Dim res As IQueryResult = query.Execute(New Object() {m_Counter,m_FirstName,m_MiddleName,m_LastName}) 
        Dim count As Integer = res.Count 'executes the query 
         
         
         
        Return res 
    End Function 
 
    Public Shared Function ReadSupplier(ByVal scope As IObjectScope,ByVal counter As Nullable(Of Long)) As IQueryResult 
        Dim query As IQuery = scope.GetSqlQuery("[ReadSupplier] ?", Nothing, "BIGINT Counter") 
        Dim res As IQueryResult = query.Execute(New Object() {counter}) 
        Dim count As Integer = res.Count 'executes the query 
         
         
         
        Return res 
    End Function 
 
    Public Shared Function DeleteSupplier(ByVal scope As IObjectScope,ByVal m_Counter As Nullable(Of Integer)) As IQueryResult 
        Dim query As IQuery = scope.GetSqlQuery("[DeleteSupplier] ?", Nothing, "INTEGER m_Counter") 
        Dim res As IQueryResult = query.Execute(New Object() {m_Counter}) 
        Dim count As Integer = res.Count 'executes the query 
         
         
         
        Return res 
    End Function 
 
    Public Shared Function CreateSupplier(ByVal scope As IObjectScope,ByVal m_FirstName As String,ByVal m_MiddleName As String,ByVal m_LastName As String) As IQueryResult 
        Dim query As IQuery = scope.GetSqlQuery("[CreateSupplier] ?,?,?", Nothing, "LONGVARCHAR m_FirstName,LONGVARCHAR m_MiddleName,LONGVARCHAR m_LastName") 
        Dim res As IQueryResult = query.Execute(New Object() {m_FirstName,m_MiddleName,m_LastName}) 
        Dim count As Integer = res.Count 'executes the query 
         
         
         
        Return res 
    End Function 
End Class 

0
Ady
Telerik team
answered on 02 Jul 2010, 09:22 AM
Hello Joebet,

When you reverse map a stored procedure , the Reversemapping wizard creates a static method(that uses ObjectScope.GetSqlQuery) which can be used to call this stored procedure. OpenAccess does not know/analyze the actual stored procedure content.

If you want to generate your stored procedure when you deploy your application you could use the 'ISchemaHandler.ExecuteDDLScript' method and specify the stored procedure SQL. You can find an example of how to use this method, here.

Hope this answers your query. Do get back in case you need further assistance.

Greetings,
Ady
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Getting Started
Asked by
Joebet
Top achievements
Rank 1
Answers by
Joebet
Top achievements
Rank 1
Ady
Telerik team
Share this question
or