--- title: "AbsolutePosition and CursorLocation Properties Example (JScript) | Microsoft Docs" ms.prod: sql ms.prod_service: connectivity ms.technology: connectivity ms.custom: "" ms.date: "01/19/2017" ms.reviewer: "" ms.topic: conceptual dev_langs: - "JScript" helpviewer_keywords: - "AbsolutePosition property [ADO], JScript example" - "CursorLocation property [ADO], JScript example" ms.assetid: bff98617-a6ba-4f41-9c5f-915161e3ea31 author: MightyPen ms.author: genemi --- # AbsolutePosition and CursorLocation Properties Example (JScript) This example demonstrates how the [AbsolutePosition](../../../ado/reference/ado-api/absoluteposition-property-ado.md) property can track the progress of a loop that enumerates all the records of a [Recordset](../../../ado/reference/ado-api/recordset-object-ado.md). It uses the [CursorLocation](../../../ado/reference/ado-api/cursorlocation-property-ado.md) property to enable the **AbsolutePosition** property by setting the cursor to a client cursor. Cut and paste the following code to Notepad or another text editor, and save it as **AbsolutePositionJS.asp**. ``` <%@LANGUAGE="JScript" %> <%// use this meta tag instead of adojavas.inc%> AbsolutePosition and CursorLocation Properties Example (JScript)

AbsolutePosition and CursorLocation Properties Example (JScript)

<% // connection and recordset variables var strCnxn = "Provider='sqloledb';Data Source=" + Request.ServerVariables("SERVER_NAME") + ";" + "Initial Catalog='Northwind';Integrated Security='SSPI';"; var rsEmployee = Server.CreateObject("ADODB.Recordset"); // display string var strMessage; try { // Open a recordset on the Employee table using // a client-side cursor to enable AbsolutePosition property. rsEmployee.CursorLocation = adUseClient; rsEmployee.Open("employees", strCnxn, adOpenStatic, adLockOptimistic, adCmdTable); // Write beginning of table to the document. Response.Write(''); Response.Write(''); Response.Write(""); while (!rsEmployee.EOF) { strMessage = ""; // Start a new table row. strMessage = ''; // First column in row contains AbsolutePosition value. strMessage += "" // First and last name are in first column. strMessage += ""; // Hire date in second column. strMessage += ""; // End the row. strMessage += ""; // Write line to document. Response.Write(strMessage); // Get next record. rsEmployee.MoveNext; } // Finish writing document. Response.Write("
AbsolutePositionNameHire Date
" + rsEmployee.AbsolutePosition + " of " + rsEmployee.RecordCount + "" + rsEmployee.Fields("FirstName") + " "; strMessage += rsEmployee.Fields("LastName") + " " + "" + rsEmployee.Fields("HireDate") + "
"); } catch (e) { Response.Write(e.message); } finally { // 'clean up if (rsEmployee.State == adStateOpen) rsEmployee.Close; rsEmployee = null; } %> ``` ## See Also [AbsolutePosition Property (ADO)](../../../ado/reference/ado-api/absoluteposition-property-ado.md) [CursorLocation Property (ADO)](../../../ado/reference/ado-api/cursorlocation-property-ado.md) [Recordset Object (ADO)](../../../ado/reference/ado-api/recordset-object-ado.md)