Name

Clone (Recordset Object) — Set rsObj2 = rsObj1 .Clone( LockType )

Synopsis

Creates an exact duplicate of a recordset and places that recordset into a second Recordset object variable.

Parameters

rsObj1

The Recordset object you wish to copy.

rsObj2

The new Recordset object into which you will place the copy of the Recordset object represented by the rsObj1 parameter.

LockType

Optional. The LockType parameter specifies the lock type of the original Recordset object being cloned. The possible values are adLockUnspecified (lock type of clone will be the same as that of the original, whatever type that is) or adLockReadOnly (the original Recordset is read-only).

Example

The following example demonstrates the use of the Clone method of the Recordset object and the fact that the same bookmark values can be used in clones as in the originals to point to the same records.

<%@ LANGUAGE="VBSCRIPT" %>
<% Response.Buffer = True %>
<HTML>
<HEAD>
<TITLE>ADO Examples</TITLE>
</HEAD>
<BODY>
<%
' Include ADOVBS.INC so we can use the ADO constants.
%>
<!-- #include virtual = "/MySSIncludes/adovbs.inc" -->
<%
Dim astrFieldNames( )
Dim astrFieldValues( )

' Instantiate an ADO Connection object.
Set objDBConn = Server.CreateObject("ADODB.Connection") 

' Construct the connection string for the Connection object.
strConn = _
   "driver={SQL Server};;uid=sa;pwd=;database=SalesDB"

' Using the connection string, open the connection.
objDBConn.Open strConn
' Instantiate two ADO Recordset objects. Set rsSales ...

Get ASP in a Nutshell, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.