Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Pass variable value back to calling function -Easy

Posted on 2006-11-07
2
Medium Priority
?
245 Views
Last Modified: 2010-04-23
VS 2005, VB.NET I have the following function:

public sub getmethodid(sopnum,custid)
which calls the following function and passes the sopnum string variable:
     validateOrder.itemcount(sopnum)  the code for this function follows:

Module validateOrder

    Public Sub itemcount(ByVal sopnum As String)

        Dim cn As New SqlClient.SqlConnection()
        Dim cmd As New SqlClient.SqlCommand()
        Dim ad As New SqlClient.SqlDataAdapter
        Dim strcn As String
        Dim strSQL As String
        Dim itmcnt As New DataSet
        Dim row As DataRow
        Dim vop10200cnt As String

        strcn = My.Settings.STRL
        cn.ConnectionString = strcn

        strSQL = "select count(*) as cnt from vop10200 where sopnumbe = '" + sopnum + "'"

        cmd.CommandText = strSQL
        ad.SelectCommand = cmd
        ad.SelectCommand.Connection = cn
        ad.Fill(itmcnt)

        cn.Close()

        For Each row In itmcnt.Tables(0).Rows

            vop10200cnt = (RTrim(row.Item("cnt")))

            If vop10200cnt = 0 Then

                Dim tableid As String = 1
                orderLog(sopnum, tableid)

sopnum = "no go"  <--------  here I am attempting to change the sopnum variable to "no go" but it does not change when passed back to getmethodid function, how can I send back the new variable value?


            Else
                getd10200cnt(sopnum, vop10200cnt)
            End If
        Next

    End Sub
0
Comment
Question by:mwalsh2000
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 48

Accepted Solution

by:
AlexFM earned 1000 total points
ID: 17891440
Public Sub itemcount(ByRef sopnum As String)
0
 
LVL 13

Expert Comment

by:newyuppie
ID: 17891501
or... turn the sub into a function that returns a string value, and return "no go", use this returned value on your getmethodid sub by calling the function itemcount and using its returned value
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

730 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