Solved

Using a Table Adapter - Passing an output parameter

Posted on 2011-03-02
4
1,171 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 500 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Suggested Solutions

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

821 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