Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

If Else From Statement... Overwrite

Status
Not open for further replies.

vb89

MIS
Aug 21, 2008
47
0
0
US
(This is a classic asp page pulling data from an oracle database)(I know this is the wrong forum but it's still the same basic fudamentals and the closes to what i need...thanks) I basically just want the first if statement to overwrite the second statement in the case that the criteria of the first if statement is met. So basically if the league_id value is 0 and the team id value is 0 I would like the tSQL function to display main.cfb_division_id = 1" and - Division: I-A"...any help on how to edit my code to do that would be great...thanks


Code:
        If iLeagueID = "0" and iTeamID = "0" then
    	tSQL = tSQL & " AND main.cfb_division_id = 1"
		tPlayerFilter = tPlayerFilter & " - Division: I-A"
        End If 
 
	    If iLeagueID = "0"  Then
	    tSQL = tSQL
        tPlayerFilter = tPlayerFilter 
		ElseIf iLeagueID = "2" Then
     	tSQL = tSQL & " AND main.cfb_division_id = 2"
	 	tPlayerFilter = tPlayerFilter & " - Division: I-AA"
		ElseIf iLeagueID = "9" Then
		tSQL = tSQL & " AND main.cfb_division_id = 9"
		tPlayerFilter = tPlayerFilter & " - Division: I-A + I-AA"
     	ElseIf iLeagueID = "1" Then
    	tSQL = tSQL & " AND main.cfb_division_id = 1"
		tPlayerFilter = tPlayerFilter & " - Division: I-A"
		End If
 
forum333

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
You could put an Else after your first If.

Code:
        If iLeagueID = "0" And iTeamID = "0" Then
            tSQL = tSQL & " AND main.cfb_division_id = 1"
            tPlayerFilter = tPlayerFilter & " - Division: I-A"
        Else
            If iLeagueID = "0" Then
                tSQL = tSQL
                tPlayerFilter = tPlayerFilter
            ElseIf iLeagueID = "2" Then
                tSQL = tSQL & " AND main.cfb_division_id = 2"
                tPlayerFilter = tPlayerFilter & " - Division: I-AA"
            ElseIf iLeagueID = "9" Then
                tSQL = tSQL & " AND main.cfb_division_id = 9"
                tPlayerFilter = tPlayerFilter & " - Division: I-A + I-AA"
            ElseIf iLeagueID = "1" Then
                tSQL = tSQL & " AND main.cfb_division_id = 1"
                tPlayerFilter = tPlayerFilter & " - Division: I-A"
            End If
        End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top