Server Side Scripting - ASP
Active Server Pages (ASP) provide a Microsoft proprietary way
to add server side scripting to a web page.
Place code (your script) in the following delimiters
<% %>
Inside the delimiters, data is written to the final output
using
Response.Write "Any text"
Any text outside the delimiters is placed
on the final page without modification.
Basic ADO Connection
Microsoft has decided that ODBC is bad - ADO is better.
Hum, seems odd since ADO uses ODBC drivers.
Even odder, ADO is slower than straight ODBC.
The following example shows one basic technique
(there are other possibilities)
using Visual Basic syntax.
This goes in Title Bar
<%
Dim objConn
Dim objRec
Set objConn = Server.CreateObject ("ADODB.Connection")
Set objRec = Server.CreateObject ("ADODB.Recordset")
objConn.Open "Driver={Microsoft Access Driver (*.mdb)};" & _
"DBQ=c:\fullpath\xx.mdb;PWD=12345"
objRec.Open "SomeTable", objConn, 0, 1, 2
While Not objRec.EOF
Response.Write objRec("FieldName") & "
"
objRec.MoveNext
Wend
objRec.Close
objConn.Close
Set objRec = Nothing
Set objConn = Nothing
%>
Specifying Table Names with Spaces
When connecting to a database, when a table name contains spaces,
special delimiters are needed - either double quotes or
square brackets.
The trick is to place double quotes inside a string.
Either of these examples will work.
objRec.Open "[Some Table]", objConn, 0, 1, 2
objRec.Open """Some Table""", objConn, 0, 1, 2
References
Author: Robert Clemenzi -
clemenzi@cpcug.org