?
Solved

Using a Table Adapter - Passing an output parameter

Posted on 2011-03-02
4
Medium Priority
?
1,265 Views
Last Modified: 2012-06-27
I created a stored procedure that takes in three parameter and returns and OUTPUT parameter which is an Integer. (No columns... just the output parameter)

How can I user a Table Adapter to return the Integer Output parameters value?

My code (below) errors stating that a DataTable can not be converted to an integer.

How do I do fix this?
 
Public Function GetPickTicketID(ByVal ComponentID As String, ByVal Inventory As String, ByVal ClientID As String) As Integer
        Dim intRecordID As Integer = IDAdapter.GetPickTicketID(ComponentID, Inventory, ClientID)
    End Function

Open in new window

tableadapter.png
0
Comment
Question by:cdemott33
  • 2
  • 2
4 Comments
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 35021733
Assuming ClientID is your OUTPUT parameter, try:
Dim intRecordID As Nullable(Of Integer) = 0
IDAdapter.GetPickTicketID(1, 2, intRecordID)

Open in new window

0
 

Author Comment

by:cdemott33
ID: 35021941
How to I return the value the GetPickTicketID method?

I can pass the intRecordID value into the method as you've instructed but how do I get the returned value from my method?  If I attempt to return the IDAdapter method I still get an error of  "DataTable can not be converted to an integer."

In other words, when I call the GetPickTicketID TableAdaptor method it should pass back (Via the Output parameter) a single integer value.  Something like 1 or 23 or 456.  My function need to return whatever that value is.

Please advise.
0
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 2000 total points
ID: 35021974
OUTPUT parameters from stored procedures are represented as ByRef parameters to the method call. So if you put you code as per my last post the OUTPUT parameters value will be written to the "intRecordID" variable, which you can then return from your method.
0
 

Author Closing Comment

by:cdemott33
ID: 35022059
Thank you, thank you , THANK YOU!  Perfect!  Your help was great appreciated.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
INTRODUCTION: While tying your database objects into builds and your enterprise source control system takes a third-party product (like Visual Studio Database Edition or Red-Gate's SQL Source Control), you can achieve some protection using a sing…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question