Solved

Pass variable value back to calling function -Easy

Posted on 2006-11-07
2
204 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
2 Comments
 
LVL 48

Accepted Solution

by:
AlexFM earned 250 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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

760 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

20 Experts available now in Live!

Get 1:1 Help Now