Glover logo

On Line Databases


Home Glovers Contact Form

Pegasus Mail

Pegasus Mail Pmail Features

Pmail Extensions

Populist Delphi (1) Delphi (2) Dos Email

Digital Cameras

Digital images Renumber images Slideshows


Online Databases Access & ASP Access & PHP Mysql & ASP Mysql & PHP

On line databases - MS Access and ASP

A facility to use MS Access databases is often offered on Microsoft web servers - seldom if ever on Linux Servers. Scripts provide for using SQL for creating, updating, appending and querying MS Access datasets (single or joined sets of tables on a client/server basis. Other features of MS Access, its internal Forms, Reports, Macros and Modules are not available online. The most common scripting language is ASP - with VB Script or possibly Jscript (virtually the same as Javascript). It is also possible to use php as the scripting language, which some may consider to have an advantage over ASP. Perl is also frequently used to script SQL queries, but is not covered here.

Connection to MS Access databases - ASP scripting

Probably the most common connection procedure is to set up a ODBC Data Source and Dataset Name (DSN). If this facility is provided, it can be used to connect to almost any of the popular database systems for which an ODBC driver is available. However on many Microsoft Servers, an alternative "DSN-less" connection protocol is offered based OLE DB.
The important statements which implement the connection are Server.CreateObject(), oConn.Open() & oConn.Execute(). See the ASP script example below. This uses VBscript ie the same Visual Basic script employed in standalone MS Access applications but with additional ADO data access statements .

<!--authquery.asp script --> <%@ LANGUAGE = VBScript %> <% Option Explicit %> <HTML> <HEAD><TITLE>Simple ADO Query</TITLE></HEAD> <BODY BGCOLOR="White" topmargin="10" leftmargin="10"> <!-- Display Header --> <font size="4" face="Arial, Helvetica"> <b>Simple ADO Query with ASP</b></font><br /> <hr size="1" color="#000000" /> Contacts within the Authors Database:<br><br> <% Dim oConn Dim oRs Dim filePath Dim Index ' Map authors database to physical path filePath = Server.MapPath("./../../incl/auth.mdb") ' Create ADO Connection Component to connect with sample database Set oConn = Server.CreateObject("ADODB.Connection") oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & filePath ' Execute a SQL query and store the results ' within recordset Set oRs = oConn.Execute("SELECT * From authors") %> <TABLE border = 1><tr bgcolor = '#DDEEAA'><th>ID</th><th>Author</th> <th>Year Born</th></tr> <% Do while (Not oRs.eof) %> <tr bgcolor = '#CCCCFF'> <% For Index=0 to (oRs.fields.count-1) %> <TD VAlign=top><% = oRs(Index)%></TD> <% Next %> </tr> <% oRs.MoveNext Loop %> </TABLE> <% oRs.close oConn.close %> </BODY></HTML>

   Demo: Example of above code