Some of you may remember when we discovered the for-case paradigm (or revisited more recently) a while back. I'm very excited today to announce the discovery of yet another "switch/case" structure abuse: the true-case paradigm. We can thank Chris for finding this "truly" creative misuse within his company's VB/ASP system ...

'objLoginValidation is a COM object that performs (surprise) login validation
'functionality, among other things.  At this point in the code, we know there
'has been a login error and are checking to see what the problem was so that
'we can provide feedback to the user describing the problem (we only use the
'best security practices!).

Select Case True
	Case objLoginValidation.error = LockedAccount
		DisplayLockedAccountError
	Case objLoginValidation.error = InvalidLastName
		DisplayInvalidLastNameError
	Case objLoginValidation.error = ClientWebAccessRevoked
		DisplayWebRevokedError
	Case objLoginValidation.error = InvalidPassword
		bIsSecondAttempt = True
		bDisplayPasswordReminder
		DisplayLogin
	Case Else
		DisplayGeneralError
End Select

You may also be interested to know that, in addition to using the best security practices, the same devlopers would always make sure that variables were "cleared out" before using them. Just in case; you know, better safe than sorry ...

Dim strSQL
strSQL = ""
strSQL = "SELECT Column FROM TABLE1"

...
strSQL = ""
strSQL = "EXEC usp_MyStoredProc"

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!