Putting a Microsoft Access Database on the Web

Articles Index

Course Listing

Free Catalog

Request Information

What's New

Page 1 | Page 2

HTML Forms

In a web environment, users input data via HTML forms. The important point here is that HTML forms have “controls” similar to Visual Basic or Delphi. Server-side scripts or CGI programs can access the values in these controls.

Active Server Pages

Active Server Pages are special web pages with an .asp extension. Pages with these extensions will be handed over by IIS to the asp.dll (the Active Server processor, search in \WINNT and you will see it) for preprocessing. These pages have scripts embedded within the normal HTML tags. These scripts are enclosed within special <%…%> tags. When the pre-processor sees these tags it will interpret the code. The code is most often written in VBScript but it could be written in a variety of other scripting languages such as JavaScript or PerlScript.

The result of the pre-processing is an expanded HTML page that is returned to the web server itself.

VBScript

VBScript is a simplified version of Visual Basic designed for scripting environments. It is based on the original BASIC language that was designed for beginning programmers. It is thus relatively user-friendly and easy to learn.

In looking at code samples there are a couple points worth highlighting.

  1. a =  b is a simple assignment of the value of b to the value of a.
  2. set a = o causes a to refer to the object o.
  3. Objects have methods, which are pieces of code that execute an action.
  4. o.doit causes the object o to execute the method doit.
  5. The dim statement is used to declare a variable (reserve memory space for it)

ADO

ADO stands for the ActiveX Data Object. This object is the workhorse in manipulating the Access data. It is used to retrieve, update, and store the data based on user inputs from HTML forms. It has various methods and collection objects. In this paper we will be concerned with only a few. However, this should be sufficient to convey some idea of the power of ASP technology.

Putting the web page pieces together

In addition to the normal HTML pages, ASP pages as described above are used to retrieve the data from the Access database. These web pages are placed on the web server in the directory reserved for the web site. VBScript is added to these pages to open a connection to the database and manipulate it. The basic steps are:

  1. Execute the server createobject method to create an ADO object
  2. Execute the ADO open method to open the ODBC connection
  3. Execute the ADO execute method to create a recordset collection object
  4. Execute various ADO methods to manipulate or access data in the recordset
  5. Close the connection and release the variables (not shown)

<!-- create ado connection referenced by the variable oconn-->
<%
dim oconn
set oconn = server.createobject("adodb.connection")
oconn.open("library2")
%>

<!-- retrieve recordset using the execute method. Create an object variable oset to refer to the recordset -->
<%
dim oset
set oset = oconn.execute("select * from authors order by auname")
oset.movefirst
%>

<!—use recordset methods to retrieve data and display the results in an HTML table -->
<table width = 80%>
<tr bgcolor = "green">
<th><font color = "yellow">Name</th>
<th><font color = "yellow">Phone</th>
<th><font color = "yellow">ID</th></font>
</tr>
<%
do until oset.eof
%>
<tr>
<td><%=oset("auname")%></td>
<td><%=oset("auphone")%></td>
<td><%=oset("auid")%></td>
</tr>
<%
oset.movenext
loop
%>
</table>

Conclusion

Database driven websites are becoming an increasingly important way of deploying database applications. The costs of deploying applications in this manner can be dramatically lower than with traditional fat-client applications based on Visual Basic.

However, this does not come without some additional complexity versus client-server. This lecture has reviewed some of the elements involved in implementing a database driven web site within the three-tier-architecture. It outlined the overall architecture, technologies, and components. Hopefully, it has also provided some idea of how to implement them all in a working website.

Return to page 1...

Dan D'Urso
Laguna Niguel
Orange County, CA 92677
October 2002
articles at dhdurso dot org


Submit the form below to be notified of new articles or other Microsoft Access resources made available...

Receive course announcements and news. Sign Up Today!





Email Marketing by VerticalResponse

Learn more about our Microsoft Access training courses..

View MS Access course catalog.


Please send comments and suggestions to WebMaster at dhdurso.org

Copyright 2017 D.H.D'Urso & Associates
Laguna Niguel, Orange County, California

 Articles Index | Close Window | Back | Top