Solved

Using a Table Adapter - Passing an output parameter

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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

809 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