Among the various ASP built-in objects, we've had occasion to discuss and use the Server Object (to create instances of other objects), the Response Object (to output script processing to a Web page), the Request Object (to handle script input from forms and query strings), and the Session Object (to server as a global repository for user sessions). As we proceed through this tutorial there will...





he process for counting visitors to a Web site is problematic. The difficulty is in deciding just Who is a visitor? or What is a visitor? or When is a visitor? On the surface it might sound easy. Simply tally a visitor whenever the person accesses a page at your site. However, this doesn't work because you end up over-counting the person who wanders from page to page.





Rather than retrieving the entire table of accounts and passwords and looking through them one at a time, we'll use an SQL SELECT statement to attempt to retrieve a matching record. That is, we'll look for a record in which the Account value from the form matches the Account value in the table, and where the Password value from the form matches the Password value in the table. We'll compose an SQL...





Most database management systems provide easier and faster ways of extracting information from their tables. The common denominator of these methods is SQL, the Structured Query Language built into these systems. SQL is a full-service language for maintaining information in a database and worthy of study in its own right. However, we'll pick and choose the features as we need them rather than...





n our example logon script we need to look through the recordset of accounts and passwords to see if the visitor entered a matching combination of values. Thus, we need to set up a program iteration, or loop, to advance the recordset cursor from one record to the next, looking for matches to the account and password entered on the form.





The ASP Recordset Object contains the properties and methods necessary to extract data from a database table and to make that set of records available to a script. Normally, you need to create as many Recordset Objects as there are tables being accessed. In the present example, we are accessing the single Accounts table from Database.mdb. Therefore, we need a single Recordset Object for our...





All interactions with the database take place on the logon.asp page. This is were we check for valid accounts and passwords.





Throughout this tutorial we will be working with information stored in databases. For our purposes we will use the Microsoft Access Database as our database management system. It is easy to learn and use and is readily available to most people with a desktop computer.





The notion is that the user can try again to enter the correct account and password. However, when the logon.asp page is redisplayed, there is no indication to the user what has happened. We can help the user understand the situation better by displaying a message indicating that an incorrect password has been entered.





When a form is submitted, the string of name/value pairs is transmitted to the server and made available to the page named in the form's ACTION parameter. That target page has access to the form data through the Request Object's Form Collection. Any scripts on the page can access these form values through the reference: Request.Form("name").





As described on the previous page, the ServerVariables Collection within the Request Object is an array of values identified by names. As such, this collection is what is traditionally called an "associative array," meaning a data structure of values indexed by names.





The ASP Response Object supplies several useful properties and methods for producing server output destined for a Web page. For example, we have used the Response.Write() method to display server data and to write HTML code to a page. As we proceed through this tutorial, other features of the Response Object are introduced as needed.





By passing the date parameter 0 (short) or 1 (long), the function returns the appropriately formatted date. By passing the time parameter 4 (short) or 0 (long), the function returns the appropriately formatted time.





he manner in which Active Server Pages operates can be illustrated very simply by using VBScript functions to display the system date and time. It is assumed that you have basic familiarity with the Visual Basic language, of which VBScript is a subset. Even if you do not know Visual Basic, you should be able to follow the examples and learn VBScript along the way.





In order to activate ASP components and to use its objects, one or more scripts are placed on the Web page along with the HTML codes specifying how the generated information is to be formatted for display in the browser. These scripts are written in the VBScript language and are contained inside the special symbols <% and %> to indicate their presence to the server:













