Matakuliah : M0492 / Web-based Programming Lanjut Tahun : 2007 Web-based Programming Lanjut Pertemuan 8 ASP and Data on the Client • • • • Bina Nusantara Disconnected Recordset Remote Data Services (RDS) Data Transfer between Server and Client Recordset Paging 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. Bina Nusantara 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 Bina Nusantara Remote Data Server Client Server Name: Client: Data store Data Binding Manager OLE-DB Provider Data Client Cache Data Source Object DataSpace Object Bina Nusantara Network DataFactory Custom Object Component Web Server 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 Component A normal COM component that has methods to perform data transfer. – Web Server, acts as the interface between client and the server. Bina Nusantara 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. Bina Nusantara 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. Bina Nusantara 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. Bina Nusantara – 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. 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 Bina Nusantara 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> Bina Nusantara RDS Data Control • Example : <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> • 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=“URL” Value=“DataPage.asp”> </OBJECT> Bina Nusantara 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 rsData.Close Set rsData = Nothing %> Bina Nusantara ‘ adPersistXML= 1 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> Bina Nusantara MSHTML Data Control • To be able to use the control, your HTML tag must have an ID attribute. <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> • 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: Bina Nusantara au_id au_lname au_fname 172-32-1176 White Bob 213-46-8915 Green Cheryl 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 <XML ID=“dsoAuthors” SRC=“Authors.xml”></XML> – Alternatively, embed the XML in the tag <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> Bina Nusantara 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 Bina Nusantara 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> Bina Nusantara Data Binding 1. 2. 3. 4. 5. 6. 7. 8. 9. <HTML> <HEAD><TITLE>TDCDataFormat.asp</TITLE></HEAD> <BODY> <H1>Data Formatting in bound data<HR></H1> <OBJECT CLASSID="clsid:333C7BC4-460F-11D0-BC04-0080C7055A83" ID="dsoImages" WIDTH="0" HEIGHT="0"> <PARAM NAME="DataURL" Value="images.csv"> <PARAM NAME = "UseHeader" VALUE = "TRUE"> </OBJECT> 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. <TABLE ID="tblData" DATASRC="#dsoImages" BORDER="1"> <THEAD> <TR> <TD>Description</TD> <TD>Image</TD> </TR> </THEAD> <TBODY> <TR> <TD><SPAN DATAFLD="Description"></SPAN></TD> <TD><SPAN DATAFLD="Image" DATAFORMATAS="HTML"></SPAN></TD> </TR> </TBODY> </TABLE> </BODY> </HTML> Bina Nusantara Data Binding Images.csv: Description,Image The asian cartoon,<IMG SRC=images\asian_cartoon.gif> The Badz-maru,<IMG SRC=images\badtzmaru.gif> The Businessman,<IMG SRC=images\biz_man.jpg> Bina Nusantara 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 Bina Nusantara Table Binding 1. 2. 3. 4. 5. 6. 7. 8. <HTML> <HEAD><TITLE>RDSTableBinding.asp</TITLE></HEAD> <BODY> <H1>Table Data Binding with RDS<HR></H1> <OBJECT CLASSID="clsid:BD96C556-65A3-11D0-983A-00C04FC29E33“ ID="dsoData" WIDTH="0" HEIGHT="0"> <PARAM NAME="URL" Value="DataPage.asp"> </OBJECT> 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. <TABLE ID="tblData" DATASRC="#dsoData" DATAPAGESIZE="5" > <THEAD> <TR> <TD>au_id</TD> <TD>au_fname</TD> <TD>au_lname</TD> <TD>phone</TD> <TD>address</TD> <TD>city</TD> <TD>state</TD> <TD>zip</TD> <TD>contract</TD> </TR> </THEAD> <TBODY> <TR> <TD><INPUT TYPE="TEXT" DATAFLD="au_id"></INPUT></TD> <TD><INPUT TYPE="TEXT" DATAFLD="au_fname"></INPUT></TD> <TD><INPUT TYPE="TEXT" DATAFLD="au_lname"></INPUT></TD> <TD><INPUT TYPE="TEXT" DATAFLD="phone"></INPUT></TD> <TD><INPUT TYPE="TEXT" DATAFLD="address"></INPUT></TD> <TD><INPUT TYPE="TEXT" DATAFLD="city"></INPUT></TD> <TD><INPUT TYPE="TEXT" DATAFLD="state"></INPUT></TD> <TD><INPUT TYPE="TEXT" DATAFLD="zip"></INPUT></TD> <TD><INPUT TYPE="TEXT" DATAFLD="contract"></INPUT></TD> </TR> </TBODY> </TABLE> </BODY> </HTML> Bina Nusantara Table Binding Bina Nusantara 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. Bina Nusantara Data Transfer Between Server and Client • Bina Nusantara 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. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. Option Explicit Private mobjConn As ADODB.Connection Private mrsBooks As ADODB.Recordset 'open the connection and recordset Public Sub OpenTitles() Set mobjConn = New ADODB.Connection Set mrsBooks = New ADODB.Recordset mobjConn.ConnectionString="Provider=SQLOLEDB; Data Source=hogwartz; Initial Catalog=pubs; User ID=sa; “ & _ letmein" mobjConn.Open mrsBooks.CursorLocation = adUseClient mrsBooks.Open "SELECT * FROM Titles", mobjConn End Sub 'Close the list Public Sub CloseTitles() 'Close the recordset If Not (mrsBooks Is Nothing) Then If mrsBooks.State = adStateOpen Then mrsBooks.Close End If Set mrsBooks = Nothing End If 'Close the connection If Not (mobjConn Is Nothing) Then mobjConn.Close Set mobjConn = Nothing End If End Sub Bina Nusantara “Password= 30. 31. 'returns the next title Public Sub NextTitle(Id As Variant, Title As Variant, Price As Variant, Notes As Variant) 32. 33. 'Ignore errors and more specifically null values in this demo On Error Resume Next 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. If IsEOF = True Then Err.Raise vbObject + 1, "BookTitles Component", "End of Cursor" Exit Sub End If 'Move to the next title If Not mrsBooks.EOF Then mrsBooks.MoveNext End Sub 48. 49. 50. Public Function IsEOF() As Boolean IsEOF = mrsBooks.EOF End Function 'Copy the fields back to the caller Id = mrsBooks.Fields("Title_id") Title = mrsBooks.Fields("Title") Price = mrsBooks.Fields("Price") Notes = mrsBooks.Fields("Notes") 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. Bina Nusantara Data Transfer Between Server and Client 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. <% Dim objTitles Set objTitles = Server.CreateObject("Book.BookTitles") %> <HTML><HEAD><TITLE>Titles List</TITLE></HEAD> <BODY> <H1>Book Titles</H1><HR> <P>The following books are currently defined in the pubs database: <TABLE cellspacing="2" cellpadding="0"> <TR> <TD bgcolor="#3AC2EF"><STRONG>ID</STRONG></TD> <TD bgcolor="#3AC2EF"><STRONG>Title</STRONG></TD> <TD bgcolor="#3AC2EF"><STRONG>Price</STRONG></TD> <TD bgcolor="#3AC2EF"><STRONG>Notes</STRONG></TD> </TR> <TR></TR> <% Dim strID Dim strTitle Dim strPrice Dim strNotes 'Initialize the list objTitles.OpenTitles 'Process each author While objTitles.IsEOF = False objTitles.NextTitle strID, strTitle, strPrice, strNotes %> <TR> <TD bgcolor="#FFFF6C"><%= strID %></TD> <TD bgcolor="#FFFF6C"><%= strTitle %></TD> <TD bgcolor="#FFFF6C"><%= strPrice %></TD> <TD bgcolor="#FFFF6C"><%= strNotes %></TD></TR> <% Wend %> </TABLE></BODY></HTML> Bina Nusantara Data Transfer Between Server and Client Bina Nusantara 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. Bina Nusantara Recordset Paging • Using ADO Paging 1. 2. 3. 4. 5. 6. 7. 8. 9. <% Dim rsData Dim intPage Dim intTotalPages Dim fldF Dim intRec Dim strQuote Dim strScriptName 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. 14. 15. 'set the page size rsData.PageSize = 10 rsData.CursorLocation = 3 'adUseClient=3 16. 17. 'Open the data rsData.Open "Authors", strConn,0,1,2 'adOpenForwardOnly=0, adLockReadOnly=1, adCmdTable=2 Bina Nusantara 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. If Request.QueryString("PAGE")="" Then intPage=1 Else intPage = CInt( Request.QueryString("PAGE") ) If intPage < 1 then intPage=1 Else If intPage > rsData.PageCount Then intPage = rsData.PageCount Else intPage = CInt( Request.QueryString("PAGE") ) End If End If End If 32. 33. rsData.AbsolutePage = intPage Response.Write "Page = " & rsData.AbsolutePage & "<BR>" 34. 35. 36. 37. 38. Response.Write "<TABLE BORDER=1><THEAD><TR>" For Each fldF In rsData.Fields Response.Write "<TD>" & fldF.Name & "</TD>" Next Response.Write "</TR></THEAD><TBODY>" 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. For intRec = 1 to rsData.PageSize If Not rsData.EOF Then Response.Write "<TR>" For Each fldF In rsData.Fields Response.Write "<TD>" & fldF.Value & "</TD>" Next Response.Write "</TR>" rsData.MoveNext End If Next Response.Write "</TBODY></TABLE></P>" Bina Nusantara 50. 51. strScriptName = Request.ServerVariables("SCRIPT_NAME") Response.Write "&nbsp;<A HREF=" & strQuote & strScriptName & "?PAGE=1" & strQuote & "> First Page </A>" 52. 53. 54. 55. 56. 57. 'Only give an active previous page if there are previous page If intPage= 1 Then Response.Write "&nbsp;<SPAN>Previous Page</SPAN>" Else Response.Write "&nbsp;<A HREF=" & strQuote & strScriptName & "?PAGE="& intPage - 1 & strQuote & "> Previous Page </A>" End If 58. 59. 60. 61. 62. 63. 'Only give an active next page if there are more pages If intPage = rsData.PageCount Then Response.Write "&nbsp;<SPAN>Next Page</SPAN>" Else Response.Write "&nbsp;<A HREF=" & strQuote & strScriptName & "?PAGE="& intPage + 1 & strQuote & "> Next Page </A>" End If 64. Response.Write "&nbsp;<A HREF=" & strQuote & strScriptName & "?PAGE=" & rsData.PageCount & strQuote & "> LastPage </A>" 65. 66. 67. rsData.Close Set rsData =Nothing %> Bina Nusantara Recordset Paging Bina Nusantara Recordset Paging • Using SQL Server CREATE PROCEDURE usp_PagedAuthors @iPage int, @iPageSize int AS BEGIN SET NOCOUNT ON -- disable row counts -- declare variables DECLARE @iStart DECLARE @iEnd DECLARE @iPageCount int int int -- start record -- end record -- 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 ) Bina Nusantara -- populate the temporary table INSERT 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, contract FROM authors -- work out how many pages there are in total SELECT @iPageCount = COUNT(*) FROM authors SELECT @iPageCount = 3 -- check the page number IF @iPage < 1 SELECT @iPage = 1 IF @iPage > @iPageCount SELECT @iPage = @iPageCount -- calculate the start and end records SELECT @iStart = (@iPage - 1) * @iPageSize SELECT @iEnd = @iStart + @iPageSize +1 -- select only those records that fall within our page SELECT au_id, au_lname, au_fname, phone, address, city, state, zip, contract FROM #PagedAuthors WHERE ID > @iStart AND ID < @iEnd DROP TABLE #PagedAuthors SET NOCOUNT OFF -- turn back on record counts RETURN @iPageCount END Bina Nusantara Recordset Paging 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. <HTML><HEAD><TITLE>SQL Paging</TITLE></HEAD> <BODY> <% Dim rsData Dim intPage Dim intLastPage Dim fldF Dim cmdAuthors Dim strQuote Dim strScriptName 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. 15. 16. 17. 18. 19. 20. 21. If Request.QueryString("PAGE")="" Then intPage=1 Else intPage = CInt( Request.QueryString("PAGE") ) If intPage < 1 then intPage=1 End If End If 22. 23. Set cmdAuthors = Server.CreateObject("ADODB.Command") Set rsData = Server.CreateObject("ADODB.Recordset") Bina Nusantara 24. 25. 26. 27. With cmdAuthors .ActiveConnection = strConn .CommandText = "usp_PagedAuthors" .CommandType = 4 'adCmdStoredProc=4 28. 29. 30. .Parameters.Append .CreateParameter("RETURN_VAL", 3, 4) 'adInteger=3 adParamReturnValue=4 .Parameters.Append .CreateParameter("@iPage", 3, 1, 8, intPage) 'adInteger=3 adParamInput=1 .Parameters.Append .CreateParameter("@iPageSize", 3, 1, 8, 10) 'adInteger=3 adParamInput=1 31. 32. Set rsData = .Execute .Execute 33. 34. End WIth intLastPage = .Parameters("RETURN_VAL") 35. Response.Write "Page = " & intPage & "<BR>“ 36. 37. 38. 39. 40. Response.Write "<TABLE BORDER=1><THEAD><TR>" For Each fldF In rsData.Fields Response.Write "<TD>" & fldF.Name & "</TD>" Next Response.Write "</TR></THEAD><TBODY>" 41. 42. 43. 44. 45. 46. 47. 48. 49. 50. 51. For intRec = 1 to rsData.PageSize If Not rsData.EOF Then Response.Write "<TR>" For Each fldF In rsData.Fields Response.Write "<TD>" & fldF.Value & "</TD>" Next Response.Write "</TR>" rsData.MoveNext End If Next Response.Write "</TBODY></TABLE></P>" Bina Nusantara 52. 53. strScriptName = Request.ServerVariables("SCRIPT_NAME") Response.Write "&nbsp;<A HREF=" & strQuote & strScriptName & "?PAGE=1" & strQuote & "> First Page </A>" 54. 55. 56. 57. 58. 59. 'Only give an active previous page if there are previous page If intPage= 1 Then Response.Write "&nbsp;<SPAN>Previous Page</SPAN>" Else Response.Write "&nbsp;<A HREF=" & strQuote & strScriptName & "?PAGE="& intPage - 1 & strQuote & "> Previous Page </A>" End If 60. 61. 62. 63. 64. 65. 'Only give an active next page if there are more pages If intPage = intLastPage Then Response.Write "&nbsp;<SPAN>Next Page</SPAN>" Else Response.Write "&nbsp;<A HREF=" & strQuote & strScriptName & "?PAGE="& intPage + 1 & strQuote & "> Next Page </A>" End If 66. Response.Write "&nbsp;<A HREF=" & strQuote & strScriptName & "?PAGE=" & intLastPage & strQuote & "> LastPage </A>" 67. 68. 69. 70. 71. 72. rsData.Close Set rsData =Nothing Set cmdAuthors = Nothing %> </BODY> </HTML> Bina Nusantara Recordset Paging Bina Nusantara