Name

Name (Command, Field, Parameter, Property Objects) — Obj .Name (= strObjName )

Synopsis

Each Command, Field, Parameter, and Property object has a Name property, which is a string value that identifies that object. The value for the Name property does not have to be unique within a collection. Note, however, that if two objects in a collection have the same name, you must use its ordinal position rather than just its name to ensure you retrieve the correct one. For example, suppose you have a recordset with two field objects both with the name "SalesPerson." The first SalesPerson field is the first in the collection and the second is the fifth. The following line of code will always retrieve the value in the first column only:

strEmployee = rsSales("SalesPerson")

To retrieve the value of the second SalesPerson field, you must use its ordinal reference:

strSecondEmployee = rsSales.Fields(5).Value

Parameters

strObjName

A string value that represents the name of the object.

Example

The following example demonstrates the use of the Name property to retrieve the names of the first and second Field objects in the Fields collection of the rsHighSales Recordset object.

<%@ 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" --> <% ' Instantiate an ADO Connection object. Set objDBConn = Server.CreateObject("ADODB.Connection") ...

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.