Re: How do you call stored procedures from VB

From: Vasu, Girish <Girish.Vasu_at_compaq.com>
Date: Thu, 4 Mar 1999 12:37:54 -0600
Message-ID: <7bmivp$7bi$1_at_mailint03.im.hou.compaq.com>


Let me know if this works!

Sub ConnectTODB()

On Error GoTo Connect_Errorhandler

Dim wrkODBC As Workspace          'WorKSpace
Dim dbTemp As Database            'Database
Dim conPubs As Connection         'Connection
Dim qdfTemp As QueryDef           'Query Defnition
Dim strMessage As String          'Query
Dim rstTemp As Recordset          'OpenRecordset
Dim ConnectStr As String          'Concatnate UserName,Password & DSN
Dim InputData As String           'to store the output from the stored
procedure

ConnectStr = "ODBC;UID=" <Userid> ";PWD=" <password>";DSN="DSN_Name" Set wrkODBC = CreateWorkspace("NewODBCWorkspace", _

        "", "", dbUseODBC)
Set conPubs = wrkODBC.OpenConnection("Connection1", , , _

        ConnectStr)

Set qdfTemp = conPubs.CreateQueryDef("")

    'Passing HostToProcess to Procedure stpExportDCSK     strMessage = "stpExportDCSK " & "'" <parameter if any>"'"

    ' Executing the Stored Procedure
    Set rstTemp = conPubs.OpenRecordset(strMessage)

    With rstTemp

          'Read line of data. That is returned by your stored procedure
          InputData = .Fields(0)

            'Statements to handle the returned values'

    End With

   rstTemp.Close

conPubs.Close
wrkODBC.Close
Exit Sub

Connect_Errorhandler:

   If Err.Number <> 0 Then

     ErrNumber% = Err.Number
     ErrDescription$ = Err.Description
     Call HandleError("ConnectDB", ErrNumber%, ErrDescription$)
     Call ExitApplication(True)

  End If
Resume Next

End Sub

Girish Vasu
Girish.Vasu_at_Compaq.com

Aaron wrote in message <36DACC46.7117B612_at_earthlink.net>...
>Can anybody show me the syntax for calling stored procedures in Oracle8
>from VB5, using RDO and ODBC? I have used the migration tool to convert
>a MS SQL Server database to Oracle and I'm a bit confused on how to
>access the stored procedures now. It has created packages and placed
>each stored procedure in a package. The stored procedures are expected
>to return a result set.
>
>Thanks,
>Aaron
>
>
>
Received on Thu Mar 04 1999 - 19:37:54 CET

Original text of this message