mark dixon, socce soft 131page 1 23 – modular design in asp

29
Interpersonal Trauma and the Inventory of Altered Self-capacities Marsha Runtz, University of Victoria John Briere, University of Southern California

Post on 19-Dec-2015

212 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Mark Dixon, SoCCE SOFT 131Page 1 23 – Modular Design in ASP

Mark Dixon, SoCCE SOFT 131 Page 1

23 – Modular Design in ASP

Page 2: Mark Dixon, SoCCE SOFT 131Page 1 23 – Modular Design in ASP

Mark Dixon, SoCCE SOFT 131 Page 2

Session Aims & Objectives• Aims

– Highlight modular design techniques in ASP

• Objectives,by end of this week’s sessions, you should be able to:

– Use procedures, functions, and parameters in ASP

Page 3: Mark Dixon, SoCCE SOFT 131Page 1 23 – Modular Design in ASP

Mark Dixon, SoCCE SOFT 131 Page 3

Example: People DatabasePersonPersonID

Surname

Forenames

Gender

Phone eMail

1 Dixon Mark Yes 01752 232556

[email protected]

2 Smith John Yes 01752 111111

[email protected]

3 Jones Sally No 01752 888888

[email protected]

4 Bloggs Fred Yes 01752 123123

[email protected]

5 Anderson Genny No 01752 987987

[email protected]

6 Smith Bob Yes 01752 898898

[email protected]

Page 4: Mark Dixon, SoCCE SOFT 131Page 1 23 – Modular Design in ASP

Mark Dixon, SoCCE SOFT 131 Page 4

Example: People (design)

Page 5: Mark Dixon, SoCCE SOFT 131Page 1 23 – Modular Design in ASP

Mark Dixon, SoCCE SOFT 131 Page 5

Example: People (code)

<script runat="server" src="_People.vbs"></script>

<html> <head><title>People</title></head> <body> <% DisplayMenu Dim rs rs = CreateObject("ADODB.Recordset") rs.Open("Person", cs) Do Until rs.EOF() Response.Write(PersonName(rs) & "<br>") rs.MoveNext() Loop rs.Close() rs = Nothing %> </body></html>

Const cs = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\People.mdb;Persist Security Info=False"Const adOpenDynamic = 3

Sub DisplayMenu() Response.Write("<center>") Response.Write("<a href='People.aspx'>People</a> ") Response.Write("<a href='Person.aspx'>Person</a>") Response.Write("</center><br><br>")End Sub

Function PersonName(r) PersonName = r.Fields("Forenames").Value & " " & r.Fields("Surname").ValueEnd Function

<script runat="server" src="_People.vbs"></script>

<html> <head><title>Person Page</title></head> <body> <% DisplayMenu Dim rs rs = CreateObject("ADODB.Recordset") rs.Open("Person", cs, adOpenDynamic) If Session("curID") <> "" Then rs.Find("[ID] = " & Session("curID")) If Request.Form("btnPrev") <> "" Then rs.MovePrevious() ElseIf Request.Form("btnNext") <> "" Then rs.MoveNext() End If End If Session("curID") = CStr(rs.Fields("ID").Value) Response.Write(PersonName(rs) & "<br>") rs.Close() rs = Nothing %> <form action="Person.aspx" method="post"> <input name="btnPrev" type="submit" value="Previous" /> <input name="btnNext" type="submit" value="Next" /> </form> </body></html>

Page 6: Mark Dixon, SoCCE SOFT 131Page 1 23 – Modular Design in ASP

Mark Dixon, SoCCE SOFT 131 Page 6

Adding VB Script file• Right click project

• click 'add new item'

Page 7: Mark Dixon, SoCCE SOFT 131Page 1 23 – Modular Design in ASP

Mark Dixon, SoCCE SOFT 131 Page 7

Tutorial Exercise: People• Task 1: Use module (files) and procedures

in your assignment.