Compiling the project
Compiling the Project
After entering the code in the class module, compile the project to make a
DLL. It would be better to reference the "Microsoft Active Server Pages
Object Library" in the project so ASP will not give us an "Out of Process
Component" error message if we try to call the component from any ASP page.
In a nutshell, what this means is that this component will know that it needs
to access the Active Server Pages DLL (asp.dll) to run. Finally, compile the
project as a DLL. Voila! You have created an ASP component that can add and remove
SQL Scheduler tasks.
Usage
Consider a scenario in which you create an e-commerce application. You have
used SQL Server for data-storage purposes. Users come and register on your site
before doing any shopping on your site, and they place orders, but leave your
site without checking out.
You should be able to delete the items they placed in their shopping basket.
It would be tedious to manually check the database for valid records and delete
the unwanted records. Instead, use the component you just created and create
a task that would search the database for invalid or unwanted records and would
delete them automatically after a certain amount of time.
Similarly, you can create and run a VB application once a month that would
remove the accomplished tasks from the SQL Server. Alternately, you could create
a component that would check and remove the unwanted tasks from the SQL Server,
create a new task manually, and call this component using the extended stored
procedures provided with SQL Server to remove the unwanted tasks from the SQL
Server. SQL Server 6.5 and later provides the capability of loading and executing
COM objects through a set of OLE Automation stored procedures or through extended
stored procedures.