Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 21st, 2003, 08:25 AM
Registered User
 
Join Date: Jun 2003
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default VB calling DB2 stored procedure

I need to call DB2 stored procedure from my VB application using ADO.
I want to call it directly without using parameter object.
ie by using "Call proc_name param1, param2, ....."
Also the stored procedure has output parameters.
Can anyone suggest how to make this call and how to retrieve the values from the output parameters?

Thanks in advance,
sangsri
Reply With Quote
  #2 (permalink)  
Old July 13th, 2005, 08:55 AM
Registered User
 
Join Date: Jul 2005
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Here is the code. The procedure executes perfectly but, it does not return the result set!!!!
I'm working on it. Let me know if I'm doing any thing wrong!!!

Vineet


Private Sub StorProcExecu()
        Dim PROD_ID_CODE As String
        Dim ALT_INV_C As Char
        Dim ELIG_CODE As Char
        Dim CLS_PRC_AMT As Decimal
        Dim DESCRIPTION As String
        Dim OleDbReader As OleDb.OleDbDataReader
        Dim OleDBStr As String = "Provider=""IBMDADB2.1"";Mode=ReadWrite;User ID=XXXXXXX;Data Source=XXXXXXX;Persist " & _
        "Security Info=True;Password=""XXXXXXX"""
        Dim OleDbConn As New OleDb.OleDbConnection(OleDBStr)
        Dim mySelectQuery As String = "call sydb2ft.fbspsm02('042991109',' ',' ','0001-01-01','0001-01-01','0001-01-01',' ',' ','A',' ');"
        'Dim mySelectQuery As String = "SELECT EMPNO FROM A004859.EMP"
        Dim OleDbCmd As New OleDb.OleDbCommand(mySelectQuery, OleDbConn)
        OleDbCmd.CommandType = CommandType.Text
        Try

            OleDbConn.Open()
            OleDbReader = OleDbCmd.ExecuteReader(CommandBehavior.CloseConnec tion)
            While OleDbReader.Read()
                PROD_ID_CODE = OleDbReader.Item("PROD_ID_CODE")
                ALT_INV_C = OleDbReader.Item("ALT_INV_C")
                ELIG_CODE = OleDbReader.Item("ELIG_CODE")
                CLS_PRC_AMT = OleDbReader.Item("CLS_PRC_AMT")
                DESCRIPTION = OleDbReader.Item("DESCRIPTION")
            End While
        Catch ex As Exception
            ex.Message.ToString()
        Finally
            OleDbReader.Close()
            OleDbConn.Close()
        End Try
    End Sub
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
calling stored procedure jomet JSP Basics 0 November 23rd, 2007 08:06 AM
Calling on a database within a stored procedure Hadware SQL Language 1 January 8th, 2007 05:11 PM
Calling Stored Procedure Using vc++ senthil_mano Visual C++ 0 August 30th, 2006 12:20 AM
Calling Stored procedure in VB.NET kganti VB.NET 2002/2003 Basics 0 March 26th, 2006 08:30 PM
Calling an Oracle Stored Procedure booksnore2 BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 2 October 1st, 2004 09:35 AM



All times are GMT -4. The time now is 02:15 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.