ASP Tutorials - Herong's Tutorial Examples - Version 5.10, by Dr. Herong Yang
"hello_access.asp" - MS Access Example
This section provides a tutorial example on how to connect ASP script pages to an MS Access database directly without using ODBC.
Here is what I did to test those steps described in the previous section:
I ran MS Access. Created a blank database file called: "hello.mdb". Then created a table called "message" in the database. In the "message" table, I added one field called "text".
Before closing the database file, I inserted one row in the "message" table with "Hello world!".
Then I copied "hello.mdb" to my local IIS server as "c:\inetpub\wwwroot\cgi-bin\hello.mdb".
My ASP script for this test was very simple, hello_access.asp:
<script language="vbscript" runat="server"> ' hello_access.asp ' Copyright (c) 2005 by Dr. Herong Yang, http://www.herongyang.com/ Set oConn = Server.CreateObject("ADODB.Connection") oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _ Server.MapPath("/cgi-bin/hello.mdb") Set oRes = oConn.Execute("SELECT * FROM message") Response.write(oRes("text")) oRes.close oConn.close </script>
This script was also copied to my local IIS server as "c:\inetpub\wwwroot\hello_access.asp".
Then I opened Internet Explorer with http://localhost/hello_access.asp. I got:
Notes on this test:
Last update: 2005.
Table of Contents