Click here to Skip to main content
15,905,508 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionWeb Service Pin
kjosh24-Aug-06 5:32
kjosh24-Aug-06 5:32 
Questionhow to hide a textBox Pin
nannapanenikamalnath24-Aug-06 4:42
nannapanenikamalnath24-Aug-06 4:42 
AnswerRe: how to hide a textBox Pin
alexfromto24-Aug-06 5:17
alexfromto24-Aug-06 5:17 
Questioninconsistency in virtual dir Pin
Kunal P24-Aug-06 4:32
Kunal P24-Aug-06 4:32 
AnswerRe: inconsistency in virtual dir [modified] Pin
Guffa24-Aug-06 9:46
Guffa24-Aug-06 9:46 
GeneralRe: inconsistency in virtual dir Pin
Kunal P24-Aug-06 20:06
Kunal P24-Aug-06 20:06 
Questionhow hide a row Pin
nidheeshkayal24-Aug-06 4:29
nidheeshkayal24-Aug-06 4:29 
QuestionLoop returns wrong result Pin
playout24-Aug-06 4:19
playout24-Aug-06 4:19 
Hi,

I have a variable I need to set, from a function in the same class. I am doing the following:

Dim FGBS1 as String = getCompanyCode(strDivisionCode)

and the other function:

        Public Shared Function getCompanyCode(ByVal strDivisionCode) As String<br />
<br />
            Dim DivisionCode As String = strDivisionCode<br />
<br />
            Dim ReturnedCompanyCode As String = ""<br />
            Dim MyCompanyCode As String<br />
<br />
            Dim CompanyCode As String = ""<br />
            Dim CompanyLevel As String = ""<br />
<br />
            Dim objConnSelectFloatSQL As SQLConnection = New SQLConnection(DB2TestConnectionString())<br />
            Dim selectFloatSQL As String<br />
    <br />
            Try<br />
<br />
                If DivisionCode <> "" Then<br />
<br />
                    'Level 4/5<br />
                    selectFloatSQL = "SELECT CompCode, CompNum from tblComp where CompNum = '" & DivisionCode.Trim() & "'"<br />
<br />
                    Dim objCmdSelectSQL As SQLCommand = New SQLCommand(selectFloatSQL, objConnSelectFloatSQL)<br />
<br />
                    objConnSelectFloatSQL.Open()<br />
<br />
                    Dim objDr As SQLDataReader = objCmdSelectSQL.ExecuteReader()<br />
                    While (objDr.Read())<br />
                        CompanyCode = objDr(0).ToString.Trim()<br />
                        CompanyLevel = objDr(1).ToString.Trim()<br />
                    End While<br />
                    objConnSelectFloatSQL.Close()<br />
<br />
                    If CompanyLevel <> "3" Then  ' either level 4 or 5<br />
                        getCompanyCode(CompanyCode)                   <br />
                    Else 'if level 3<br />
                        MyCompanyCode = CompanyCode<br />
                    End If<br />
                Else<br />
                    MyCompanyCode = "LEVEL does not exist for:" & strDivisionCode<br />
                End If<br />
<br />
            Catch ex As Exception<br />
                Dim strExceptionMsg As String = "Error Executing GetAS400InvoiceDetails(): " & ex.Message & "\r\n"<br />
                Throw New Exception(strExceptionMsg, ex)<br />
<br />
            Finally<br />
<br />
                objConnSelectFloatSQL.Close()<br />
            End Try<br />
 <br />
                Return MyCompanyCode<br />
            End If<br />
<br />
<br />
        End Function


Now, my problem is, that the function needs to loop through itself to bring back a certain level(a string in the DB). Basically if I return say level 5, it has to go back to the function again, it will bring back level 4, but it has to go back, until it brings back level 3. My problem is this - I get the correct level (3), but I also bring back two empty strings, and that overrides my first value.

Say I get CompCode = "001"
It returns "001", "" , "" and thus FGBS1 = ""

How do I get pass this?
AnswerRe: Loop returns wrong result Pin
Brent Lamborn24-Aug-06 5:04
Brent Lamborn24-Aug-06 5:04 
AnswerRe: Loop returns wrong result Pin
Paddy Boyd24-Aug-06 5:15
Paddy Boyd24-Aug-06 5:15 
QuestionPage Performance Pin
Amit Kumar G24-Aug-06 4:07
Amit Kumar G24-Aug-06 4:07 
QuestionWeb Site Installation Problem Pin
alexfromto24-Aug-06 3:32
alexfromto24-Aug-06 3:32 
QuestionRenamning Files Pin
kirthikirthi24-Aug-06 2:39
kirthikirthi24-Aug-06 2:39 
AnswerRe: Renamning Files Pin
coolestCoder24-Aug-06 3:48
coolestCoder24-Aug-06 3:48 
AnswerRe: Renamning Files Pin
Suresh Pirsquare24-Aug-06 3:52
Suresh Pirsquare24-Aug-06 3:52 
GeneralRe: Renamning Files Pin
kirthikirthi24-Aug-06 23:03
kirthikirthi24-Aug-06 23:03 
GeneralRe: Renamning Files Pin
_AK_24-Aug-06 23:06
_AK_24-Aug-06 23:06 
GeneralRe: Renamning Files Pin
Suresh Pirsquare24-Aug-06 23:54
Suresh Pirsquare24-Aug-06 23:54 
GeneralRe: Renamning Files Pin
Suresh Pirsquare24-Aug-06 23:57
Suresh Pirsquare24-Aug-06 23:57 
GeneralRe: Renamning Files [modified] Pin
Suresh Pirsquare25-Aug-06 0:01
Suresh Pirsquare25-Aug-06 0:01 
GeneralRe: Renamning Files Pin
kirthikirthi25-Aug-06 0:10
kirthikirthi25-Aug-06 0:10 
GeneralRe: Renamning Files [modified] Pin
Suresh Pirsquare25-Aug-06 0:26
Suresh Pirsquare25-Aug-06 0:26 
GeneralRe: Renamning Files Pin
kirthikirthi25-Aug-06 1:23
kirthikirthi25-Aug-06 1:23 
GeneralRe: Renamning Files Pin
Suresh Pirsquare25-Aug-06 1:43
Suresh Pirsquare25-Aug-06 1:43 
QuestionHow to count listbox items in codebehind when i add item using Javascript! Pin
Chetan.visodiya24-Aug-06 2:15
Chetan.visodiya24-Aug-06 2:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.