You are here: Reference > JavaScript > client-side > ActiveX > ADO > methods > namedRecordset (applet, object, xml)

namedRecordset method (applet, object, xml)

Browser support:
Returns a recordset object that represents the records of the specified data member from a data source object.

Syntax:

object.namedRecordset (recordName [, subChapter]);
You can find the related objects in the Supported by objects section below.

Parameters:

recordName
Required. String that specifies the name of the data member. Use an empty string to get the default data member (such as the recordset property).
subChapter
Optional. String that specifies a hierarchical path to a sub-dataset.

Return value:

Returns a recordset object or null.

Example HTML code 1:

This example illustrates the use of the namedRecordset method:
Code
news.xml
<head>
    <script type="text/javascript">
        function OnNewsComplete () {
            var boundingObj = event.srcElement;

            var items = boundingObj.namedRecordset ("", "item");
            items.MoveFirst ();

            while (!items.EOF) {
                var title = items.Fields ("title").value;
                var link = items.Fields ("link").value;
                DisplayItem (title, link);
                items.MoveNext ();
            }
        }

        function DisplayItem (title, link) {
            var htmlcode = '<i><a href="'+link+'" target="_blank">'+title+'</a><br /></i>';
            document.getElementById ('news').innerHTML += htmlcode;
        }
    </script>
</head>
<body>
    <xml src="news.xml" onDatasetComplete="OnNewsComplete ();"></xml>
    <div id="news"></div>
</body>
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content