Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Creating a Stored Procedure Via OLE DB
Message
De
28/04/2006 16:10:19
Cindy Winegarden
Duke University Medical Center
Durham, Caroline du Nord, États-Unis
 
 
À
28/04/2006 15:38:14
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01117539
Message ID:
01117660
Vues:
14
>>....is it possible to create a new stored procedure via OLE DB if there are no stored procedures at all?
>
>There are built-in procedures.
>
>
>EXECSCRIPT("APPEND PROCEDURES FROM ...")
>
Here's an example:
Imports System
Imports System.Data
Imports System.Data.OleDb

Module Module1

    Sub Main()

        Try

            Dim cn1 As New OleDbConnection( _
                         "Provider=VFPOLEDB.1;Data Source=C:\Program Files\Microsoft Visual FoxPro 9\Samples\Northwind\Northwind.dbc;")
            cn1.Open()
            '-- C:\HelloWorld.txt
            '-- Procedure(HelloWorld)
            '--     Return "Hello World"
            '-- EndProc()

            Dim cmd1 As New OleDbCommand( _
                "ExecScript('Append Procedures From C:\HelloWorld.txt')", cn1)
            cmd1.ExecuteNonQuery()

            Dim cmd2 As New OleDbCommand("HelloWorld()", cn1)
            Dim val1 As String = cmd2.ExecuteScalar()
            MsgBox(val1.ToString())

            cn1.Close()

        Catch e As Exception
            MsgBox(e.ToString())
        End Try

    End Sub

End Module
Thanks Alexy for all your help. (Now I'm off to answer a newsgroup question.)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform