Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > VB.NET 2002/2003 Basics
|
VB.NET 2002/2003 Basics For coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 2002/2003 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 11th, 2004, 01:00 PM
Registered User
 
Join Date: Jun 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default problems with stored proc and output parameters

I am trying to run a stored procedure off an MSDE setup on my computer. Using VS.NET I can actually run the stored proc and see my results and my ouput parameters. Yet when I put it into VB code and try to see it nothing comes up. I still can't figure out if there is a miscommunication between MSDE and my VB app or what is going on.

here is the code that i am using to called the stored proc and everything. The stored proc takes one input parameter and returns multiple result sets and an output parameter

Dim temp As String
        Dim parm1, parm2 As SqlParameter
        Dim TableNames() As String

        parm1 = New SqlParameter("@YearXX", SqlDbType.VarChar, 4)
        parm1.Direction = ParameterDirection.Input
        parm1.Value = "03"
        SelectCmd.Parameters.Add(parm1)

        parm2 = New SqlParameter("@ValidMonths", SqlDbType.VarChar, 250)
        parm2.Direction = ParameterDirection.InputOutput
        parm2.Value = "NA"
        SelectCmd.Parameters.Add(parm2)


        SelectCmd.CommandText = "[LoadDB]"
        SelectCmd.ExecuteReader()

        temp = SelectCmd.Parameters("@ValidMonths").Value()
        MessageBox.Show(temp)

Thank you in advance for the help

Matt

 
Old June 12th, 2004, 07:11 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 839
Thanks: 0
Thanked 1 Time in 1 Post
Default

Output parameters are not available until you have read all the resultsets first.

Jeff Mason
Custom Apps, Inc.
www.custom-apps.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
unicode parameters in stored proc CharityPays SQL Server 2000 1 November 12th, 2006 12:02 AM
Return output variable to VB from SQL stored proc busterbunny BOOK: Beginning Visual Basic 2005 Databases ISBN: 978-0-7645-8894-5 1 March 27th, 2006 10:24 PM
How i can OUTPUT in Stored Proc yoord SQL Server 2000 2 July 19th, 2004 03:11 PM
Optional Stored Proc Parameters? VBAHole22 SQL Server 2000 3 August 13th, 2003 11:46 AM
Passing Parameters to Stored Proc mdillard Classic ASP Professional 6 June 10th, 2003 10:35 PM





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