ASP - WWW - Database Connections. Example1




What is sever side scripting?

ASP and VB script

Inbuilt objects in Active Server Pages, ASP, for administration of questions and answers in connection with creating and administration of WWW-pages: (see also ASP tutorial. http://www.w3schools.com/asp/default.asp).
  • Application - handles status information within apllications
  • Session - handles user information at the server during a session
  • Request - contains information sent from the browser to the server (e.g. from a form)
  • Response - writes information (e.g. HTML code) from the server to the browser
  • Server - gives access to server handling functions
  • ObjectContext - to start and interupt transactions administered by the Transaction Server
ASP can handle different script languages such as VBScript (Microsoft Visual Basic script) and Java scripts.
Scripts are surrounded by < and >, e.g. < SCRIPT LANGUAGE = VBScript >

Script files may be included
<!-#include virtual=/asp_include_files/table_header.asp >

You can write your own 'If..Then...Else ... End If' statements, Select Case expression, For Next loops, While and Do loops, procedures and functions.

Examples

See also the ASP/html page that procuces the dynamic html-page sent to the client in example 2 and example 3.

You will find the database used in the examples at http://it.civil.auc.dk/it/education/sem6_1998/exercises/db_normalise.html

Tips

You can debug your ASP-script by placing Response.write statements at proper places.

Response.Write "output text"
can also be written in short form as
<%= "output text" %>

Now go to the Exercise




Server installations

Windows XP

First install Internet Information Services IIS
  1. Install Sercice Pack 2 under Windows XP
  2. Control panel
  3. Add/remove windows components
  4. Mark Internet Information Services (IIS) in the Windows Component Wizard
Set up the database connection
  1. Control Panel
  2. Perfomance and Maintenance
  3. Adminsitrative tools
  4. Data Sources (ODBS)
  5. System DSN (in the ODBC Data Source Administrator)
  6. Add
  7. Driver to Microsoft Access (*.mdb)
  8. Data Source Name the name of the db
  9. Select and browse to your database

Windows 2000

  1. Install Option Pack 4 under Windows NT (Personal Web Server, PWS) and add Internet Service Manager (ISM) (click 'Custom' during installation and 'Personal Web Server').
  2. Install Service Pack 4 (or higher) found at http://www.micorsoft.com/ntserver/nts/downloads/
  3. Start the Web server by using the Internet Service Manager, ISM.
    From 'Programs', 'Windows NT4.0 Option Pack', 'Microsoft personal web server', 'Internet Service Manager' or 'Personal Web Manager'.
  4. For all users to have access to the data source (a database etc.) establish it as system data source (DSNs Data Source Names) from 'Control Panel', 'ODBC Data Source Admin', 'System DNS', add Microsoft Access Driver (*.mdb). Select the data source (type .mdb if a database).


References




©Per Christiansson, 17.9.2007, (23.8.2001) [16.10.2000]