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.NET
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
VB.NET General VB.NET discussions for issues that don't fall into other VB.NET forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 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
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 5th, 2005, 08:58 AM
Authorized User
Join Date: Apr 2005
Location: Kuruman, Northern Cape, South Africa.
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to EricJ
Default Trouble with returning parameter values

I have a loop writes data into a sql database which it reads from a datareader.

Once the first record is added, a return value must be specified from the stored procedure in:

        Do While myDataReader.Read

            cmdInsertCurrency.Parameters.Clear() 'Clear the return value for adding of the next available record
            cmdInsertCurrency.Parameters.Add("@RETURN VALUE", DbType.Int32, 0)
            cmdInsertCurrency.Parameters("@RETURN VALUE").Direction = ParameterDirection.ReturnValue
            cmdInsertCurrency.Parameters.Add("@CURRENCY_ID", DBNull.Value)
            cmdInsertCurrency.Parameters.Add("@CURRENCY_CODE", myDataReader.Item(1))
            cmdInsertCurrency.Parameters.Add("@CURRENCY_NAME", myDataReader.Item(2))
            cmdInsertCurrency.Parameters.Add("@START_DATE", #1/1/2000#)
            cmdInsertCurrency.Parameters.Add("@END_DATE", #12/31/9998#)
            cmdInsertCurrency.Parameters.Add("@CHANGE_ID", Decimal.Zero)
            cmdInsertCurrency.Parameters.Add("@SITE_AUDIT_ID", "20120050027000001")
            cmdInsertCurrency.Parameters.Add("@USER_AUDIT_ID", "c242242")
            cmdInsertCurrency.Parameters.Add("@PARENT_AUDIT_ID ", DBNull.Value)

                myParamAdapter.InsertCommand = cmdInsertCurrency
            Catch ex As Exception
                Exit Do
            End Try

            iNumOfRecordsAffected += 1


It writes my values to the database correctly, but appart from the @RETURN VALUE I specified, I also want to return the value assigned to "@CURRENCY_ID" which is a GUID in my database. Is there any way that I can tell the loop what this value is, as I keep getting a null value returned in the console window.

Can anybody please help me out?

Reply With Quote

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
VB2005 trouble returning structure from function MikeCS Visual Basic 2005 Basics 1 November 29th, 2006 07:45 PM
Returning Decimal values from database hasanali00 BOOK: ASP.NET Website Programming Problem-Design-Solution 3 October 10th, 2005 08:10 PM
EXEC function not returning values aingalsbe PHP How-To 0 June 1st, 2004 10:03 AM
Methods - Returning Multiple Values? p_nut33 VB.NET 2002/2003 Basics 5 December 22nd, 2003 10:09 AM
returning values with SQL stu9820 SQL Language 6 December 8th, 2003 02:36 PM

All times are GMT -4. The time now is 03:00 PM.

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