• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 15. Using ASP with JavaScript > Reading an Access 2000 Database with AS...

Reading an Access 2000 Database with ASP

After the Access 2000 database has been set up and a DSN has been established for it, you are ready to create an ASP page to pull data from the Access file and send it to JavaScript. To begin, enter the following ASP script and save it in the root directory or a subdirectory within the root directory of your server. Save the file using the name readDB1.asp.

readDB1.asp

<% 
Dim hookUp, Conn, ViewRecord, Lname, output, display, SQL 
hookUp= "Driver={Microsoft Access Driver (*.mdb)}; 
DBQ=d:\Inetpub\Wwwroot\hotJava\javaS.mdb;" Set Conn = 
Server.CreateObject("ADODB.Connection") 
Set ViewRecord = Server.CreateObject("ADODB.Recordset") 

Conn.Open hookUp 
SQL="SELECT * FROM JavaStable" 
ViewRecord.Open SQL, Conn 

Do While Not ViewRecord.EOF 
      Lname=ViewRecord("Lname") & "<br>" 
      display =display & Lname 
      ViewRecord.MoveNext 
Loop 
Response.Write display 
ViewRecord.Close 
Conn.Close 
Set ViewRecord = Nothing 
Set Conn = Nothing 
%> 


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint