Using ASP Middleware for Paging through a Dataset
Web applications have evolved from very basic display of commercial information to very complex, data-driven, functional full scale applications in a very short period of time. 4-5 years ago it was a full application to be able to collect form data and Email it to a certain mailbox, now, that ability is usually one feature of a much larger system.Web applications have evolved from very basic display of commercial information to very complex, data-driven, functional full scale applications in a very short period of time. 4-5 years ago it was a full application to be able to collect form data and Email it to a certain mailbox, now, that ability is usually one feature of a much larger system.
As technology has evolved quickly, developer's needs and imagination has evolved even more quickly. Those of you familiar with Visual Basic 5 & 6 are well aware of the powerful web features that have evolved into the language, from the newest WebClasses to the Internet Controls, however, can you write a high performance CGI-style application, using VB 4!
Several years ago, I found a module posted in a public newsgroup on the Internet for using VB4 to develop CGI style applications. Keep in mind that when I found this module, Visual Interdev and ASP were only just released. The basic premise for the module is this:
A. User submits a form - the action of the form is an EXE
file compiled by VB
B. The EXE File uses the STDIN port to read the form variables using either PUT or GET methods.
C. EXE File processes the form, performs necessary calculations, data transactions, etc.
D. EXE sends back HTML through the STDOUT port.
1. Fast processing because the EXE is compiled not interpreted like ASP Code is.
2. Server side processing with the results being sent in standard HTML for browser independence.
3. Full functionality of the Visual Basic Language.
I am not going to go through all of the code here, at the end of this article is a link to download the module. I am going to highlight a few of the basic routines.
If you look in the Sub Main() routine you will see that there are basically three commands. They are:
INITCGI - This routine receives all of the HTTP header and environment variables and posts it into variables that you can access.
GETFORMDATA - This routine will take any form data or query string data and post it into an array called tpair, tpair is basically a 2 dimensional array with a Name element and a Value element.
CGI-MAIN - This is where you start writing your code. All of your code starts in a subroutine called CGI-MAIN and you are free to do whatever you want from here.
Important support routines:
GETCGIVALUE - This routine allows you to pass the name of a CGI variable coming from a form and it will return the associated value.
SEND - Probably the most important routine. You send this routine a string of HTML data and it will send that data out through the STDOUT port and to the client browser.
Hopefully, you can see the value of this kind of compiled approach especially in a situation where you are performing a single task such as generating a report on a large amount of data but you don't have the ability to implement a full COM Object for the task.