Solved

Using a Table Adapter - Passing an output parameter

Posted on 2011-03-02
4
1,140 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Thank you, thank you , THANK YOU!  Perfect!  Your help was great appreciated.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

763 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now