Visual InterDev

Recordset Design-Time Control

See Also      Tasks      Properties

Creates a Recordset script object, which enables you to access data from a page. The Recordset control acts as a data source when binding data-bound design-time controls.

Remarks

You can set the properties of the Recordset control at design time on the control itself and in the Recordset Properties dialog box.

The Recordset control defines a set of records that you can access from your Web pages. The Recordset control specifies a data connection, a database object or SQL statement, and other properties that determine how data is read from and written to a database, such as cursor type and cursor location.

Tip   If you have a data command in your Data Environment, you can drag the data command from the Project Explorer onto your page and Microsoft® Visual InterDev™ automatically creates a Recordset control that is bound to the DE object. For information on the Data Environment, see The Data Environment.

The Recordset control is of key importance when you want to access data with the data-bound design-time controls. The data-bound controls are Label, Checkbox, Textbox, OptionGroup, Listbox, RecordsetNavbar, Grid, and FormManager.

In order to access data with these controls, first you add one or more Recordset controls to a page. Then, you add a design-time control and set its Recordset property to one of the Recordset controls on the page.

The scripting platform determines where script is run - either on the client (Microsoft® Internet Explorer 4.0 DHTML) or on the server (ASP). Thus, the scripting platform determines whether a script object is available under Client Objects & Events or Server Objects & Events in the Script Outline window.

The Scripting platform property for the Recordset control is specified on the Implementation tab of the Recordset Properties dialog box. The default setting of the Scripting Platform property is "Inherit from Page."

You can change the scripting platform for the page itself by changing the DOCUMENT's DTCScriptingPlatform property. To do this, right-click on the page (not a DTC), and select Properties to display the DOCUMENT Properties dialog box. In the dialog box, select Server or Client under DTC scripting platform. For detailed information about choosing a scripting platform, see Writing Script for Script Objects.

When you bind one of the data-bound controls to a Recordset control, the data-bound control's Scripting platform property value is inherited from the Recordset control's.

To bind a design-time control to a Recordset control

  1. After you've added a Recordset control to your page, drag a data-bound control from the Toolbox onto the page. (A small, yellow database icon designates that a control can be data-bound.)

  2. Right-click the data-bound control and select Properties.

  3. In the Recordset drop-down list, select a recordset that you want to bind the current control to. The list contains all the Recordset controls on the page.

  4. In the Field drop-down list, select one of the recordset's fields.

  5. Click the Apply button. Notice that Scripting platform property is now read-only. The setting has been inherited from the Recordset control.

  6. Set the other properties of the control as appropriate and click Apply.

Note   When you change the scripting platform for the Recordset control, all the controls that are bound to it automatically inherit the scripting platform.

For an overview about data binding, see Data Binding. For information on scripting and objects, see Scripting with Design-Time Controls and Script Objects.

Scripting Notes

To move the cursor position within the recordset, call the move, moveFirst, movePrevious, moveNext, moveLast, moveAbsolute, getBookmark, setBookmark methods.

Use the BOF and EOF properties to verify if the current record location is valid.

To modify the recordset, call the methods updateRecord, cancelUpdate, addRecord, and deleteRecord.

To return the number of records in the recordset, call the getCount method.

When opening and closing a recordset, call the open, close and isOpen methods.

For more information about the run-time object, see Recordset Script Object. For information on scripting and objects, see Scripting with Design-Time Controls and Script Objects.