Previous Code Entry
Left Arrow
Twitter Style Load More Results with jQuery and Ajax in Classic ASP & SQL Server
Current Code Entry
Next Code Entry
How to check if value is NULL
Right Arrow
Splitting IF statement in multiple lines
Article Entry Date: February 11,2023 @ 11:37:07 / Last Updated On: February 11,2023 @ 12:20:54
In ASP Classic, a very long if statement with multiple AND's and OR's can become unreadable, especially if you constantly add to them.
When your code has a lot of different Queries that show relative information and use the same database statements, you may find yourself using that same connection instead of recreating it. And this is where very long IF and/or THEN statements come into play.

A typical IF Statement will look like this.


Now, let us take a look at a more complex statement.
This first code is on one single line. This is an example of what I just encountered during the development of our new website, which will be released by the end of February 2023. (Link will be provided here once it is LIVE).

So, this IF statement consists of a lot of different getType Queries.


This is broken down by line of the above IF Statement.
Making it a lot easier to work with, as we will be adding more and more Queries to this IF Statement as time goes on.
In the below IF Statement, we separated each line with an underscore _.
This information was found @ copyprogramming.com«.