0 évaluation0% ont trouvé ce document utile (0 vote)
44 vues6 pages
8hort Course Lab Exercise Copyright (c) 2002 Temasek Polytechnic Continuing Education Centre (CEC) Master Active Server Pages in 24 Hours / 10 Oct 2002. Students should be able to: Connect to a Access database using ASP (VBScript) programming.
8hort Course Lab Exercise Copyright (c) 2002 Temasek Polytechnic Continuing Education Centre (CEC) Master Active Server Pages in 24 Hours / 10 Oct 2002. Students should be able to: Connect to a Access database using ASP (VBScript) programming.
Droits d'auteur :
Attribution Non-Commercial (BY-NC)
Formats disponibles
Téléchargez comme PDF, TXT ou lisez en ligne sur Scribd
8hort Course Lab Exercise Copyright (c) 2002 Temasek Polytechnic Continuing Education Centre (CEC) Master Active Server Pages in 24 Hours / 10 Oct 2002. Students should be able to: Connect to a Access database using ASP (VBScript) programming.
Droits d'auteur :
Attribution Non-Commercial (BY-NC)
Formats disponibles
Téléchargez comme PDF, TXT ou lisez en ligne sur Scribd
At the end of this lab exercise, students should be able to:
Connect to a Access database using ASP (VBScript) programming Read from a Access database table using ASP (VBScript) programming Insert records to a Access database table using ASP (VBScript) programming
Please read Day 15, 16 & 17 of the textbook. The lecturer will go through the example programs with you. Please try the exercises (Just do it) yourself after the examples.
0 Create a Access database Create an Access database called WidgetWorld.mdb, save it into c:\temp\yourname\ Refer to P520 (or the subject web site) for the table information.
1 Opening the connection and list properties of connection (P514)
The Program <% Set Conn = Server.CreateObject("ADODB.Connection") Conn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ="& _ server.mappath("WidgetWorld.mdb")
Dim objProp For Each objProp in Conn.Properties Response.Write objProp.Name & ": " & objProp.Value & "<BR>" Next
Conn.Close Set Conn=Nothing
%>
2.1 Opening a connection, save as a file (P514)
The Program (use Macromedia Dreamweaver)
8hort Course Lab Exercise
Copyright 2002 Temasek Polytechnic Continuing Education Centre (CEC) Master Active Server Pages in 24 Hours / 10 Oct 2002
2
<% Dim objConn Set objConn = Server.CreateObject("ADODB.Connection") objConn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & _ server.mappath("WidgetWorld.mdb")
%>
2.2 List Properties using the connection created (P514)
The Program <% @ Language=VBScript %> <% Option Explicit %>
objRS.Close set objRS=Nothing objConn.Close Set objConn=Nothing %>
</body> </html>
The Exercise (Just do it) (P531)Create a database, with a table called tblEmployees, it should have the following fields: Field Name Datatype Name Text IDNumber Number Salary Currency BeganWorking Date/Time
Write an ASP page to open the table and display the records. Test it first with the table empty and then add at least six entries and test it again.
4.1 Create a Access database Create an Access database called users.mdb, save it into c:\temp\yourname\ Refer to the subject web site for the table information.
4.2 Add record to a table and display table (P535)
The Program <% @ Language=VBScript %> <% Option Explicit %>
<% objRS.MoveNext Loop objRS.Close set objRS=Nothing objConn.Close Set objConn=Nothing
%> </table> </body> </html>
8hort Course Lab Exercise
Copyright 2002 Temasek Polytechnic Continuing Education Centre (CEC) Master Active Server Pages in 24 Hours / 10 Oct 2002
6
The Exercise (Just do it) (P537) Create a page for your users to register. This is a two-page process. The first page (a .htm file) has the form that the user enters his information into. The form then passes that information to the second page (a .asp file), which enters the information into the database.