m0194 web-based programming lanjut
DESCRIPTION
M0194 Web-based Programming Lanjut. Session 8. ASP and Data on the Client. Disconnected Recordset Remote Data Services (RDS) Data Transfer between Server and Client Recordset Paging. Disconnected Recordset. - PowerPoint PPT PresentationTRANSCRIPT
2004 Tau Yenny, SI - Binus
M0194 Web-based Programming Lanjut
Session 8
2004 Tau Yenny, SI - Binus
2
ASP and Data on the Client
Disconnected Recordset Remote Data Services (RDS) Data Transfer between Server and Client Recordset Paging
2004 Tau Yenny, SI - Binus
3
Disconnected Recordset
A disconnected recordset is just a normal recordset, but its connection to the server removed.
The recordset stands alone, can act like a normal recordset, allowing updates, additions, and deletions.
But changes only happen in the recordset, are not reflected in the server.
The connection to the server can be re-established and the server updated with any changes
If data on the server has changed, you can detect these changes. This is called conflict resolution.
2004 Tau Yenny, SI - Binus
4
Remote Data Service (RDS)
RDS is the name given to the set of services that allows us to handle data on the client.
RDS is part of ADO Only comes into use when you need to
transfer and use data at the client Made up from several components
2004 Tau Yenny, SI - Binus
5
Remote Data ServerServer
DataFactory
Object
Custom
Component
Web
Server
Data store
OLE-DB
Provider
Client
DataSpace
Object
DataClientCache
DataSourceObject
DataBinding
Manager
Name:
Client:
Network
2004 Tau Yenny, SI - Binus
6
Remote Data Server RDS Server Components
Data store
OLE DB Provider
Two option how work with the data The DataFactory
The default server-side component, provides access to data stores
A Custom ComponentA normal COM component that has methods to perform data transfer.
Web Server, acts as the interface between client and the server.
2004 Tau Yenny, SI - Binus
7
Remote Data Server RDS Client Components
DataSpace Object goes hand-in-hand with the DataFactory or a Custom Component, provides the client-
side part of the equation. DataSpace is a proxy object, responsible for the communication with the server,
providing the channel through which data is moved. Created by using an HTML <OBJECT> tag.
Data Source Object (DSO) Responsible for storing data on the client, contains an ADO Recordset and work
together with the Client Data Cache to manage the data Created by using an HTML <OBJECT> tag
Client Data Cache The client cursor service managing the data on the client
Data Binding Manager Create the link (binding) between the HTML controls and the DSO. Perform by
specifying the DATASRC and DATAFLD attributes of certain HTML controls.
2004 Tau Yenny, SI - Binus
8
Remote Data Server Browser Support for RDS
Only works in Microsoft browsers Fully supported on Microsoft Internet Explorer 4.0 and
above Be aware, clients accessing application that rely on RDS
might have different versions with the server. For example, IE4 shipped with RDS 1.5, while IE5, Office2000 and Visual Studio 6 with RDS 2.0, Windows 2000 with RDS 2.5
Two ways to take care of compability problem : Make sure all users upgrade to the latest version of RDS. Specify the Data Factory Mode when connecting to data
source. Specify which version to use.
2004 Tau Yenny, SI - Binus
9
Remote Data Server Data Source Objects
Is a client-side object that stores and manages the data once it is on the client.
Several different DSO : Tabular Data Control (TDC) is design to manipulate data held in a tabular
or delimited from text files.
Remote Data Service Data Control is design to connect to OLEDB data stores, and can specify where to connect to as well as which data to return
Java DataBase Connector is a Java applet that allows connection to data stores through the Java DataBase Control (JDBC).
Microsoft HTML (MSHTML) DSO takes data marked up in HTML and uses this as the source of the data.
XML DSO uses XML data, and can be used for either well-structured or arbitrarily structured XML.
2004 Tau Yenny, SI - Binus
10
Tabular Data Control TDC is the simplest DSO, useful for small amounts of data that
will be read-only. Created by placing an <OBJECT> tag
<OBJECT CLASSID=“clsid:333C7BC4-460F-11D0BC04-0080C7055A83”
ID=“dsoEmployee” WIDTH=“0” HEIGHT=“0”>
<PARAM NAME=“DataURL” Value=“Employee.csv”>
</OBJECT>
example of data in Comma Separated Values (CSV):PMA42628M,"Paolo","M","Accorti",13,35,"0877",1992-08-27 00:00:00
PSA89086M,"Pedro","S","Afonso",14,89,"1389",1990-12-24 00:00:00
VPA30890F,"Victoria","P","Ashworth",6,140,"0877",1990-09-13 00:00:00
H-B39728F,"Helen"," ","Bennett",12,35,"0877",1989-09-21 00:00:00
L-B31947F,"Lesley"," ","Brown",7,120,"0877",1991-02-13 00:00:00
F-C16315M,"Francisco"," ","Chang",4,227,"9952",1990-11-03 00:00:00
2004 Tau Yenny, SI - Binus
11
RDS Data Control RDS Data Control provides access to normal data stores, as
opposed to flat files. Most often used to connect to SQL database to retrieve data from
tables queries or stored procedures Allow data to be update Created using an HTML <OBJECT> tag
<OBJECT CLASSID=“clsid:BD96C556-65A3-11D0-983A-00C04FC29E33”
ID=“dsoAuthors” WIDTH=“0” HEIGHT=“0”>
<PARAM NAME=“Connect” Value=“Connection String”>
<PARAM NAME=“Server” Value=“Server Name”>
<PARAM NAME=“SQL” Value=“Query Text”>
</OBJECT>
2004 Tau Yenny, SI - Binus
12
RDS Data Control Example :
ADO 2.5 has a new URL property that allows to use file as the source of data.
<OBJECT CLASSID=“clsid:BD96C556-65A3-11D0-983A-00C04FC29E33”
ID=“dsoAuthors” WIDTH=“0” HEIGHT=“0”>
<PARAM NAME=“Connect” Value=“DSN=pubs”>
<PARAM NAME=“Server” Value=“W2000”>
<PARAM NAME=“SQL” Value=“SELECT * FROM Authors”>
</OBJECT>
<OBJECT CLASSID=“clsid:BD96C556-65A3-11D0-983A-00C04FC29E33”
ID=“dsoAuthors” WIDTH=“0” HEIGHT=“0”>
<PARAM NAME=“URL” Value=“DataPage.asp”>
</OBJECT>
2004 Tau Yenny, SI - Binus
13
RDS Data Control The DataPage.asp file could contain the following VBScript code :
<!-- #include file="dataconn.inc" -->
<%
Dim rsData
Set rsData = Server.CreateObject (“ADODB.Recordset”)
rsData.Open “SELECT * FROM Authors”, strConn
rsData.Save Response, 1 ‘ adPersistXML= 1
rsData.Close
Set rsData = Nothing
%>
2004 Tau Yenny, SI - Binus
14
MSHTML Data Control
MSHTML is rather unusual – is part of IE Allows to have a data source based on HTML. MSHTML is not a form that naturally use for data storage MSHTML could be useful if you have a lot of HTML pages that
do contain some data. MSHTML data control has a Recordset property, but has no
methods.
Created by <OBJECT> tag<OBJECT ID=“dsoAuthors” DATA=“Authors.html” HEIGHT=“0” WIDTH=“0”>
</OBJECT>
2004 Tau Yenny, SI - Binus
15
MSHTML Data Control To be able to use the control, your HTML tag must have an ID
attribute.
The example above show that the HTML tag names are irrelevant – it’s the ID that is important.
The above HTML, would generate 2 rows of data, that looked like this:
<DIV ID=“au_id”>172-32-1176</DIV>
<SPAN ID=“au_lname”>White</SPAN>
<H1 ID=“au_fname”>Bob</H1>
<PRE ID=“au_id”>213-46-8915</PRE>
<H2 ID=“au_lname”>Green</H2>
<H1 ID=“au_fname”>Cheryl</H1>
au_id au_lname au_fname
172-32-1176 White Bob
213-46-8915 Green Cheryl
2004 Tau Yenny, SI - Binus
16
XML Data Control The <XML> tag acts like a data control Use the <XML> tag in one of two ways:
The first way, use the SRC attribute to specify the location of the data
Alternatively, embed the XML in the tag
<XML ID=“dsoAuthors” SRC=“Authors.xml”></XML>
<XML ID=“dsoAuthors”> <Authors> <Author>
<au_id>172-32-1176</au_id><au_lname>White</au_lname><au_fname>Johnson</au_fname><phone>408 496-7223</phone><contract>True</contract>
</Author> <Author>
<au_id>213-46-8915</au_id><au_lname>Green</au_lname><au_fname>Marjorie</au_fname><phone>415 986-7020</phone><contract>True</contract>
</Author> </Authors></XML>
2004 Tau Yenny, SI - Binus
17
Data Binding
Binding means setting up a relationship between some HTML elements and the data control. The data control is responsible for managing the data and supplying the
data to the HTML element The element displays the data on the screen
To bind an HTML element to a data source, specify two attributes for it:
DATASRC, to identify the data control that contains the data. Always put a # in front of the data source name.
DATAFLD, to identify the field in the data control to bind to. The fields are the names identifying the columns in the data that the data control manages.
DATAFORMATS, to indicate how the data in the field should formatted, can be either HTML or TEXT. The default is TEXT
2004 Tau Yenny, SI - Binus
18
Data Binding<HTML><HEAD><TITLE>RDSSingleBinding.asp</TITLE></HEAD><BODY><H1>Data Binding with RDS<HR></H1><OBJECT CLASSID="clsid:BD96C556-65A3-11D0-983A-00C04FC29E33"
ID="dsoAuthors" WIDTH="0" HEIGHT="0"><PARAM NAME="URL" Value="DataPage.asp"></OBJECT>
<DIV DATASRC="#dsoAuthors" DATAFLD="au_fname"></DIV><DIV DATASRC="#dsoAuthors" DATAFLD="au_lname"></DIV></BODY></HTML>
2004 Tau Yenny, SI - Binus
19
Data Binding
1. <HTML>2. <HEAD><TITLE>TDCDataFormat.asp</TITLE></HEAD>3. <BODY>4. <H1>Data Formatting in bound data<HR></H1>5. <OBJECT CLASSID="clsid:333C7BC4-460F-11D0-BC04-0080C7055A83"6. ID="dsoImages" WIDTH="0" HEIGHT="0">7. <PARAM NAME="DataURL" Value="images.csv">8. <PARAM NAME = "UseHeader" VALUE = "TRUE">9. </OBJECT>
10. <TABLE ID="tblData" DATASRC="#dsoImages" BORDER="1">11. <THEAD>12. <TR>13. <TD>Description</TD>14. <TD>Image</TD>15. </TR>16. </THEAD>17. <TBODY>18. <TR>19. <TD><SPAN DATAFLD="Description"></SPAN></TD>20. <TD><SPAN DATAFLD="Image"
DATAFORMATAS="HTML"></SPAN></TD>21. </TR>22. </TBODY>23. </TABLE>24. </BODY>25. </HTML>
2004 Tau Yenny, SI - Binus
20
Data Binding
Description,ImageThe asian cartoon,<IMG SRC=images\asian_cartoon.gif>The Badz-maru,<IMG SRC=images\badtz-maru.gif>The Businessman,<IMG SRC=images\biz_man.jpg>
Images.csv:
2004 Tau Yenny, SI - Binus
21
Table Binding
Table binding differs from single record binding, because we bind to the TABLE element. This allows to see more than one record at a time.
Table binding has one attribute useful to data binding – DATAPAGESIZE. This determines how many records are shown in the table
2004 Tau Yenny, SI - Binus
22
Table Binding1. <HTML>2. <HEAD><TITLE>RDSTableBinding.asp</TITLE></HEAD>3. <BODY>4. <H1>Table Data Binding with RDS<HR></H1>5. <OBJECT CLASSID="clsid:BD96C556-65A3-11D0-983A-00C04FC29E33“ 6. ID="dsoData" WIDTH="0" HEIGHT="0">7. <PARAM NAME="URL" Value="DataPage.asp">8. </OBJECT>
9. <TABLE ID="tblData" DATASRC="#dsoData" DATAPAGESIZE="5" >10. <THEAD>11. <TR>12. <TD>au_id</TD>13. <TD>au_fname</TD>14. <TD>au_lname</TD>15. <TD>phone</TD>16. <TD>address</TD>17. <TD>city</TD>18. <TD>state</TD>19. <TD>zip</TD>20. <TD>contract</TD>21. </TR>22. </THEAD>23. <TBODY>24. <TR>25. <TD><INPUT TYPE="TEXT" DATAFLD="au_id"></INPUT></TD>26. <TD><INPUT TYPE="TEXT" DATAFLD="au_fname"></INPUT></TD>27. <TD><INPUT TYPE="TEXT" DATAFLD="au_lname"></INPUT></TD>28. <TD><INPUT TYPE="TEXT" DATAFLD="phone"></INPUT></TD>29. <TD><INPUT TYPE="TEXT" DATAFLD="address"></INPUT></TD>30. <TD><INPUT TYPE="TEXT" DATAFLD="city"></INPUT></TD>31. <TD><INPUT TYPE="TEXT" DATAFLD="state"></INPUT></TD>32. <TD><INPUT TYPE="TEXT" DATAFLD="zip"></INPUT></TD>33. <TD><INPUT TYPE="TEXT" DATAFLD="contract"></INPUT></TD>34. </TR>35. </TBODY>36. </TABLE>37. </BODY>38. </HTML>
2004 Tau Yenny, SI - Binus
23
Table Binding
2004 Tau Yenny, SI - Binus
24
Data Transfer Between Server and Client Some problem we need to solve
We need a secure way to retrieve data from a server and use it on the client
We need a way that allows data to be updated We don’t want to compromise flexibility
The way around this problem is to use components. A component allows us to encapsulate all of our
data access functionality, including the source of the data, and ensures that data are only exposed to Web page.
2004 Tau Yenny, SI - Binus
25
Data Transfer Between Server and Client A server based component
The component creator uses a programming language that can create COM components specification. For example, Visual Basic(VB) or Visual C++(VC++).
The client has a programming language or tool (Such as Microsoft Word or ASP) that know how to instantiate and use COM components, by following the rules laid down in the COM specification.
Example – creating Book Component
Start Visual Basic and create a new ActiveX DLL project, changing the name of the default class module to BookTitles.
Next, change the name of the project to Book.
Add a reference that we need in the project.
2004 Tau Yenny, SI - Binus
261. Option Explicit
2. Private mobjConn As ADODB.Connection3. Private mrsBooks As ADODB.Recordset
4. 'open the connection and recordset5. Public Sub OpenTitles()6. Set mobjConn = New ADODB.Connection7. Set mrsBooks = New ADODB.Recordset8. 9. mobjConn.ConnectionString="Provider=SQLOLEDB; Data Source=hogwartz; Initial Catalog=pubs; User ID=sa; “ & _
“Password= letmein"10. mobjConn.Open11. 12. mrsBooks.CursorLocation = adUseClient13. mrsBooks.Open "SELECT * FROM Titles", mobjConn14. End Sub
15. 'Close the list16. Public Sub CloseTitles()17. 'Close the recordset18. If Not (mrsBooks Is Nothing) Then19. If mrsBooks.State = adStateOpen Then20. mrsBooks.Close21. End If22. Set mrsBooks = Nothing23. End If
24. 'Close the connection25. If Not (mobjConn Is Nothing) Then26. mobjConn.Close27. Set mobjConn = Nothing28. End If29. End Sub
2004 Tau Yenny, SI - Binus
2730. 'returns the next title31. Public Sub NextTitle(Id As Variant, Title As Variant, Price As Variant, Notes As Variant)
32. 'Ignore errors and more specifically null values in this demo33. On Error Resume Next
34. If IsEOF = True Then35. Err.Raise vbObject + 1, "BookTitles Component", "End of Cursor"36. Exit Sub37. End If38. 39. 'Copy the fields back to the caller40. Id = mrsBooks.Fields("Title_id")41. Title = mrsBooks.Fields("Title")42. Price = mrsBooks.Fields("Price")43. Notes = mrsBooks.Fields("Notes")44. 45. 'Move to the next title46. If Not mrsBooks.EOF Then mrsBooks.MoveNext47. End Sub
48. Public Function IsEOF() As Boolean49. IsEOF = mrsBooks.EOF50. End Function
If you tried defining the NextTitle procedure Parameter using the String and Currency types, you’d get an error. Because the Active Scripting engine only know the Variant type.
2004 Tau Yenny, SI - Binus
28
Data Transfer Between Server and Client1. <% Dim objTitles
2. Set objTitles = Server.CreateObject("Book.BookTitles")3. %>4. <HTML><HEAD><TITLE>Titles List</TITLE></HEAD>5. <BODY>6. <H1>Book Titles</H1><HR>7. <P>The following books are currently defined in the pubs database:8. <TABLE cellspacing="2" cellpadding="0">9. <TR> <TD bgcolor="#3AC2EF"><STRONG>ID</STRONG></TD>10. <TD bgcolor="#3AC2EF"><STRONG>Title</STRONG></TD>11. <TD bgcolor="#3AC2EF"><STRONG>Price</STRONG></TD>12. <TD bgcolor="#3AC2EF"><STRONG>Notes</STRONG></TD> </TR>13. <TR></TR>14. <%15. Dim strID16. Dim strTitle17. Dim strPrice18. Dim strNotes19. 'Initialize the list20. objTitles.OpenTitles21. 'Process each author22. While objTitles.IsEOF = False23. objTitles.NextTitle strID, strTitle, strPrice, strNotes24. %>25. <TR> <TD bgcolor="#FFFF6C"><%= strID %></TD>26. <TD bgcolor="#FFFF6C"><%= strTitle %></TD>27. <TD bgcolor="#FFFF6C"><%= strPrice %></TD>28. <TD bgcolor="#FFFF6C"><%= strNotes %></TD></TR>29. <% Wend %>30. </TABLE></BODY></HTML>
2004 Tau Yenny, SI - Binus
29
Data Transfer Between Server and Client
2004 Tau Yenny, SI - Binus
30
Data Transfer Between Server and Client
Advantages of using Server Side Components There are no connection details visible to the user – which
gives you a securer system. The component also has to be specially registered, so there is the added security restriction.
You can build components in any COM compliant language. We use VB in this example, because it’s easy to understand.
Your components isn’t limited to just returning and updating recordsets but you could build in lots of logic.
You could encapsulate all of that conflict resolution code in the Recordset method, and just return details of any errors. This means your client-side script is neater and users can’t rip off your hard-worked code.
2004 Tau Yenny, SI - Binus
31
Recordset Paging Using ADO Paging
1. <%2. Dim rsData3. Dim intPage4. Dim intTotalPages5. Dim fldF6. Dim intRec7. Dim strQuote8. Dim strScriptName9. Dim strConn
10. strConn = " Provider = SQLOLEDB; Data Source= Hogwartz; Initial Catalog= pubs; User ID= sa; Password=letmein"
11. strQuote = Chr(34) 'the double quote character
12. Set rsData = Server.CreateObject("ADODB.Recordset")
13. 'set the page size14. rsData.PageSize = 1015. rsData.CursorLocation = 3 'adUseClient=3
16. 'Open the data17. rsData.Open "Authors", strConn,0,1,2 'adOpenForwardOnly=0, adLockReadOnly=1, adCmdTable=2
2004 Tau Yenny, SI - Binus
3218. If Request.QueryString("PAGE")="" Then19. intPage=120. Else21. intPage = CInt( Request.QueryString("PAGE") )22. If intPage < 1 then23. intPage=124. Else25. If intPage > rsData.PageCount Then26. intPage = rsData.PageCount27. Else28. intPage = CInt( Request.QueryString("PAGE") )29. End If30. End If31. End If
32. rsData.AbsolutePage = intPage33. Response.Write "Page = " & rsData.AbsolutePage & "<BR>"
34. Response.Write "<TABLE BORDER=1><THEAD><TR>"35. For Each fldF In rsData.Fields36. Response.Write "<TD>" & fldF.Name & "</TD>"37. Next38. Response.Write "</TR></THEAD><TBODY>"
39. For intRec = 1 to rsData.PageSize40. If Not rsData.EOF Then41. Response.Write "<TR>"42. For Each fldF In rsData.Fields43. Response.Write "<TD>" & fldF.Value & "</TD>"44. Next45. Response.Write "</TR>"46. rsData.MoveNext47. End If48. Next49. Response.Write "</TBODY></TABLE></P>"
2004 Tau Yenny, SI - Binus
3350. strScriptName = Request.ServerVariables("SCRIPT_NAME")51. Response.Write " <A HREF=" & strQuote & strScriptName & "?PAGE=1" & strQuote & "> First Page
</A>"
52. 'Only give an active previous page if there are previous page53. If intPage= 1 Then54. Response.Write " <SPAN>Previous Page</SPAN>"55. Else56. Response.Write " <A HREF=" & strQuote & strScriptName & "?PAGE="& intPage - 1 &
strQuote & "> Previous Page </A>"57. End If
58. 'Only give an active next page if there are more pages59. If intPage = rsData.PageCount Then60. Response.Write " <SPAN>Next Page</SPAN>"61. Else62. Response.Write " <A HREF=" & strQuote & strScriptName & "?PAGE="& intPage + 1 &
strQuote & "> Next Page </A>"63. End If
64. Response.Write " <A HREF=" & strQuote & strScriptName & "?PAGE=" & rsData.PageCount & strQuote & "> LastPage </A>"
65. rsData.Close66. Set rsData =Nothing67. %>
2004 Tau Yenny, SI - Binus
34
Recordset Paging
2004 Tau Yenny, SI - Binus
35
Recordset Paging Using SQL Server
CREATE PROCEDURE usp_PagedAuthors @iPage int,@iPageSize int
ASBEGIN
SET NOCOUNT ON -- disable row counts
-- declare variablesDECLARE @iStart int -- start recordDECLARE @iEnd int -- end recordDECLARE @iPageCount int -- total number of pages
CREATE TABLE #PagedAuthors -- create the temporary table(
ID int IDENTITY,au_id varchar(11) NOT NULL,au_lname varchar(40) NOT NULL,au_fname varchar(20) NOT NULL,phone char(12) NOT NULL,address varchar(20) NULL,city varchar(20) NULL,state char(2) NULL,zip char(5) NULL,contract bit NOT NULL
)
2004 Tau Yenny, SI - Binus
36-- populate the temporary tableINSERT INTO #PagedAuthors (au_id, au_lname, au_fname, phone, address, city, state, zip, contract)SELECT au_id, au_lname, au_fname, phone, address, city, state, zip, contractFROM authors
-- work out how many pages there are in totalSELECT @iPageCount = COUNT(*)FROM authors
SELECT @iPageCount = 3
-- check the page numberIF @iPage < 1
SELECT @iPage = 1IF @iPage > @iPageCount
SELECT @iPage = @iPageCount
-- calculate the start and end recordsSELECT @iStart = (@iPage - 1) * @iPageSizeSELECT @iEnd = @iStart + @iPageSize +1
-- select only those records that fall within our pageSELECT au_id, au_lname, au_fname, phone, address, city, state, zip, contractFROM #PagedAuthorsWHERE ID > @iStartAND ID < @iEnd
DROP TABLE #PagedAuthors
SET NOCOUNT OFF -- turn back on record counts
RETURN @iPageCount END
2004 Tau Yenny, SI - Binus
37
Recordset Paging1. <HTML><HEAD><TITLE>SQL Paging</TITLE></HEAD>2. <BODY>3. <%4. Dim rsData5. Dim intPage6. Dim intLastPage7. Dim fldF8. Dim cmdAuthors9. Dim strQuote10. Dim strScriptName11. Dim strConn
12. strConn="Provider=SQLOLEDB;Data Source=Hogwartz;Initial Catalog=pubs;User ID=sa; Password=letmein"
13. strQuote = Chr(34) 'the double quote character
14. If Request.QueryString("PAGE")="" Then15. intPage=116. Else17. intPage = CInt( Request.QueryString("PAGE") )18. If intPage < 1 then19. intPage=120. End If21. End If
22. Set cmdAuthors = Server.CreateObject("ADODB.Command")23. Set rsData = Server.CreateObject("ADODB.Recordset")
2004 Tau Yenny, SI - Binus
3824. With cmdAuthors25. .ActiveConnection = strConn26. .CommandText = "usp_PagedAuthors"27. .CommandType = 4 'adCmdStoredProc=4
28. .Parameters.Append .CreateParameter("RETURN_VAL", 3, 4) 'adInteger=3 adParamReturnValue=4
29. .Parameters.Append .CreateParameter("@iPage", 3, 1, 8, intPage) 'adInteger=3 adParamInput=130. .Parameters.Append .CreateParameter("@iPageSize", 3, 1, 8, 10) 'adInteger=3 adParamInput=1
31. Set rsData = .Execute32. .Execute
33. intLastPage = .Parameters("RETURN_VAL")34. End WIth
35. Response.Write "Page = " & intPage & "<BR>“
36. Response.Write "<TABLE BORDER=1><THEAD><TR>"37. For Each fldF In rsData.Fields38. Response.Write "<TD>" & fldF.Name & "</TD>"39. Next40. Response.Write "</TR></THEAD><TBODY>"
41. For intRec = 1 to rsData.PageSize42. If Not rsData.EOF Then43. Response.Write "<TR>"44. For Each fldF In rsData.Fields45. Response.Write "<TD>" & fldF.Value & "</TD>"46. Next47. Response.Write "</TR>"48. rsData.MoveNext49. End If50. Next51. Response.Write "</TBODY></TABLE></P>"
2004 Tau Yenny, SI - Binus
3952. strScriptName = Request.ServerVariables("SCRIPT_NAME")53. Response.Write " <A HREF=" & strQuote & strScriptName & "?PAGE=1" & strQuote & "> First Page
</A>"
54. 'Only give an active previous page if there are previous page55. If intPage= 1 Then56. Response.Write " <SPAN>Previous Page</SPAN>"57. Else58. Response.Write " <A HREF=" & strQuote & strScriptName & "?PAGE="& intPage - 1 &
strQuote & "> Previous Page </A>"59. End If
60. 'Only give an active next page if there are more pages61. If intPage = intLastPage Then62. Response.Write " <SPAN>Next Page</SPAN>"63. Else64. Response.Write " <A HREF=" & strQuote & strScriptName & "?PAGE="& intPage + 1 &
strQuote & "> Next Page </A>"65. End If
66. Response.Write " <A HREF=" & strQuote & strScriptName & "?PAGE=" & intLastPage & strQuote & "> LastPage </A>"
67. rsData.Close68. Set rsData =Nothing69. Set cmdAuthors = Nothing70. %>71. </BODY>72. </HTML>
2004 Tau Yenny, SI - Binus
40
Recordset Paging