Given by Nancy McCracken and Sangetta Aggarwal at CPS616 Technologies of Information Age on Spring 1998. Foils prepared 4 Feb 98
Outside Index
Summary of Material
This describes Microsoft's extended HTML web based language ASP (Active Server Pages) for use of Microsoft Access database system |
see Access used with JDBC |
Outside Index Summary of Material
8/14/97 |
written by Sangeeta Agarwal, |
Nancy McCracken |
NPAC |
Features |
Microsoft ACCESS is a desktop relational database interactive management system developed for Microsoft Windows. |
The databases of Microsoft ACCESS can be managed via
|
ACCESS is particularly useful because of its completeness and its user friendliness of its editing interface, the tabular visualization of the data (table browser) and for the ease of query definitions and graphic output. |
Access 97 integrates data from spreadsheets and other databases and is the easy way to find answers, share information over intranets and the Internet, and build faster business solutions. |
The interface usability of ACCESS offers the possibility to consult and edit the data and to execute the queries in an immediate and intuitive way. Defining forms allows the development of the GUI interfaces for the database. |
Form and Report Wizards help create Access forms and reports from database information with little user intervention |
Table Analyzer Wizard analyzes the structure of flat-file data, and undertakes the normalization process for users |
Simple Query Wizard helps users find exactly the information they seek |
Database Wizard allows users without any database experience to create one of more than 20 fully functional database applications |
Performer Analyzer Wizard analyzes the structure of a database and suggests areas for improvement |
OLE Automation allows users to share information across applications. |
Support for ActiveX Controls - ActiveX controls can be embedded directly in Office files, allowing developers to create fully programmable documents and forms with enhanced capabilities for online viewing |
An 'object' is what can be seen in the database window --tables, queries, forms, fields, indexes, controls etc. To create an Access application, objects have to be created and manipulated in response to events which are simply change in state occurring for example, when the mouse is moved, a button is clicked etc.. |
Event Handlers in Access are Macro, Event procedure, Global module function and Form module function. All except the Macro use the VBA (Visual Basic for Applications) language. 3 type of events can occur for a form:
|
The tool provided for Visual Basic provides ability to create and manipulate one's classes of objects and encapsulating data and processes within an object. Class modules also allow the ability to abstract complex processes. |
By using object-oriented techniques, one can create classes, their objects, properties, define methods and hence make development simple. |
Class modules have 2 events -- Initialize (creation of a class) and Terminate (destruction of the class). Class hierarchies can be built depending on relationships. |
The relational database model was conceived in 1969 by E.F.Codd. |
The model is based on mathematical theory viz. a database consists of a series of unordered tables (or relations) that can be manipulated using non-procedural operations that return tables. |
Benefits of a relational database:
|
Each table in a relational database is made unique by designating a 'primary key' - a column or set of columns that have unique values. A table can have only one primary key. A 'foreign key' is a column in one table that references the primary key of another table. |
There are 3 types of relationships amongst two tables:
|
Many-to-Many - For each row in the first table, there can be many rows in the second table, and for each row in the second table, there can be many rows in the first table. |
The relational model specifies two Integrity rules:
|
The textual query definition is done using SQL (Structured Query Language), a non-procedural data access language. |
Access SQL support a subset of SQL-89 and some elements of the newer SQL-92 standard. |
Most of Access SQL directly maps to Access QBE (Query by Example) in both directions. Queries can be constructed using QBE and viewed in SQL by switching to SQL view. Queries can also be directly entered using SQL view. |
SQL Statements:
|
Syntax of SELECT clause: |
SELECT {* | expression1 [AS alias1][, expression2 [AS alias2][,..]]]} |
Example: SELECT * |
SELECT LastName |
SELECT [Customer#], LastName, FirstName |
Syntax of FROM clause: |
FROM table-or-query [AS alias] |
Example: SELECT * from tblOrder; |
SELECT OrderId, OrderDate FROM tblOrder as [Orders Table]; |
Syntax of WHERE clause: |
WHERE expression1 [{And | Or} expression2[..]] |
Example: SELECT OrderId FROM tblOrder WHERE OderTakerId = 2; |
SELECT OrderId, OrderDate FROM tblOrder WHERE Sex="Female" AND Age BETWEEN 21 AND 29; |
Syntax of ORDER BY clause: |
ORDER BY column1 [{ASC | DESC}][,column2[{ASC | DESC}][,..]] |
Example: SELECT * FROM tblCustomer ORDER BY LastName, FirstName; |
The UPDATE Statement: Used to change values in one or more columns in a table. |
Syntax: UPDATE table-or-query |
SET column1=expression1[,column2=expression2][,..] |
[WHERE criteria]; |
Example: UPDATE tblMenu SET tblMenu.Price = {Price]*1.1 WHERE MenuDescription Not Like "*Pizza"; |
The DELETE Statement: Used to delete rows from tables.
|
FROM from-clause |
[WHERE criteria]; |
Example: DELETE FROM tblMenu WHERE Discontinued = True; |
The INSERT INTO Statement: Used to copy rows from one table into another or to add a single row of data to a table using a list of values. |
Syntax: INSERT INTO target-table |
select-statement; |
Example: INSERT INTO tblCustomer SELECT * FROM tblCustomerNew; |
The SELECT INTO Statement: It is unique to Access SQL, Used to create a new table from the rows in another table or query. |
Syntax: SELECT column1 [,column2[,..]] INTO new-table |
Example: SELECT OrderId, OderDate INTO tblJonesOrders FROM tblOrder WHERE CustomerId=9; |
Access SQL supports 4 DDL (Data Definition Language) statements:
|
Data Access Objects (DAO) is another method, like DDL, to programmatically create and manipulate table schemas in Access. |
Controls are the workhorses of Access. They are used for inputting and outputting data, and for displaying static information. They can be used as global variables, to calculate intermediate values. Forms and reports share the same controls. |
Some controls have values, given by user at design time, by the data from which the control is being fed, or by the user at run time. Eg. for a text box, the value is the text inside the box; for a list box, the control value is the one chosen. |
Controls have properties which can be set or changed by the application. Access provides the Tag property which allows the user to specify and store upto 2048 characters of information attached to any control. |
Beyond the tabular vision, for consultation and editing of data, there is a form editor and a form interpreter that allows the generation and management of specific input/output data interfaces (forms). |
The usage of forms allows the visualization in a single window interface of data belonging to different tables and query results. |
In Access, program code and a form (or report) is stored in a neat package. Each form and report can carry its own module with it. The event procedures are subroutines and their scope, by default, is private to the form. |
Reports are information organized and formatted to fit the user's specifications. They provide a way to retrieve and present data as meaningful information. Examples are mailing labels, invoices, sale summaries, phone lists etc. |
Main issue is handling errors that occur when locks are placed on pages of records. The following considerations are important:
|
There are two overlapping security models:
|
Client-Server database applications shift the burden of data storage and manipulation to a dedicated application. In such applications Access provides the interface to the server data. |
Some methods for retrieving data from a server are:
|
Access 97 makes it easy to share up-to-date information with others, regardless of where they are. With features of exporting dynamic forms to HTML and publishing them on the Web, it provides for sharing of dynamic or static database information across the Internet or intranet. |
HyperLinks - Users can store hyperlinks in all MS Access databases to connect to information anywhere. Hyperlinks can be control-based i.e text box, combo box, label, command button, image control, can be bound to fields with a Hyperlink datatype.
|
Data can be published in 3 formats:
|
The ASP files also contain ODBC connection information to connect to an ODBC data source (Access database). The connection information includes the data source name, and user name and password (if user-level security is needed). |
After the database has been published, the IIS, upon request from the web browser, runs the VBScript code, calls the ActiveX Server Controls, opens the Access database, runs the queries present in the ASP files to access the data, merges the results and HTML tags in the ASP file into one file and then sends it back to the browser for display as a Web page. |
The adjoining figure shows the components for connecting to databases from Peer Web Services. |
<HTML><TITLE>Employees Directory</TITLE><BODY> |
<h2> <center><font color=red>Form for Employees Directory</font></center></h2> |
<% |
If IsObject(Session("workpg_conn")) Then |
Set conn = Session("workpg_conn") workpg is ODBC System |
Else DSN for an Access db |
Set conn = Server.CreateObject("ADODB.Connection") |
conn.open "workpg","","" |
Set Session("workpg_conn") = conn |
End If |
%> |
<% |
If cstr(Request.QueryString("ok_ans")) <> "" Then |
rs.Fields("ok_ans").Value = Request.QueryString("ok_ans") |
End If |
If cstr(Request.QueryString("OptBody6")) <> "" Then |
rs.Fields("OptBody6").Value = Request.QueryString("OptBody6") |
End If |
% > |
<SCRIPT LANGUAGE=VBScript> |
<!-- |
Dim rgszCtrls(24, 2) |
Dim cMaxCtrls |
cMaxCtrls = 24 |
Sub AddCtrlToList(szCtrl, szCtrlSrc) |
Dim i |
for i = 1 to cMaxCtrls |
if rgszCtrls(i, 1) = szCtrl Then Exit Sub |
if rgszCtrls(i, 1) = "" Then |
rgszCtrls(i, 1) = szCtrl |
rgszCtrls(i, 2) = szCtrlSrc |
Exit Sub |
End If |
next |
End Sub |
Sub UpdateRefreshBtn() |
nav_btn_MoveCancelUpdate.Caption = "Cancel" |
End Sub |
--> |
</SCRIPT> |
Automation is a technology that allows two separate applications components to communicate with each other as either data exchanges or commands issued by one component for the other to perform. |
It requires a client and a server. The client uses the services of an automation server. It implements a development language used to write code to control the server. Capacity to use pre-built, robust and debugged software components in applications. |
Automation Clients are Access, MS Excel, Word, PowerPoint, Visual Basic, and any application supporting VBA. |
Sessions begin with the client applications creating an object, i.e. establishing a conversation with the server application and telling it which of its objects are required to be controlled. |
Class Objects exposed by MS Office 97 applications |
------------------------------------------------------------------------------------------ |
Server Name Class Name Description |
------------------------------------------------------------------------------------------- |
Access Application Pointer to an instance of MS Access. |
Excel Application Pointer to an instance of MS Excel Chart Pointer to a new Chart object. Launches Excel & opens a new workbook if reqd |
Sheet Pointer to new Worksheet object. Launches Excel and opens a new workbook if reqd. |
Outlook Application Pointer to an instance of MS Outlook. |
PowerPoint Application Pointer to an instance of MS Powerpoint. |
Word Application Pointer to an instance of MS Word. Document Pointer to a new Document object. Launches Word if reqd. |
Examples of the types of automation solutions that can be built are:
|
Power Point |
Access |
Word |
Automation |
Web |
Web |
Web |
Excel |
Web |