You can improve both your productivity and your Web applications’ performance by judiciously using server includes. And if you use Visual Basic (VB) instead of Active Server Pages (ASP) for database development, you can use includes in your code modules to reap the same benefits.

How’s that, you say? For example, you can collect SQL Server Magazine’s tips and techniques for creating high-performance code and build those code routines into your include files. You and other developers can then use those routines to help build your applications.

Consider the following function, called RunSQL:

Function RunSQL(strSQL)
       Dim cmd
       Set cmd = CreateObject("ADODB.Command")
       cmd.ActiveConnection = GetDSN()
       cmd.CommandText = strSQL
       cmd.CommandType = adCmdText
       cmd.Execute , , ADODB.adExecuteNoRecords
       Set cmd.ActiveConnection = Nothing
       Set cmd = Nothing
     End Function

The RunSQL function executes an SQL statement but doesn’t generate a record set. This function is particularly handy for Insert, Update, and Delete statements that don’t return a record set. You could just rely on your developers to remember how to execute SQL statements and not return a record set. Or you could put this function in an include file so your developers could simply call RunSQL and pass in the SQL statement. In addition, most programmers will likely use RunSQL over and over instead of writing the ADO code themselves, so they’ll have more time to perform other tasks.

You can even automate the use of includes in your development tools. If you’re using Visual InterDev, for instance, you can place the include statement on the Toolbox:

<!--#INCLUDE FILE="Database.asp"-->

Then, whenever you need the include statement, you can drag it from the Toolbox and drop it on the page. You can also place the functions in the include file on the Toolbox. Even better, you can build code libraries into COM objects, then put references to methods on the Toolbox. All sorts of possibilities exist for using includes to speed up application development and application performance.