Querying the Database

See Also

Once you've added a data connection to a database, you can query the database to specify a set of records that you want to use with a particular Web page. Microsoft® Visual InterDev™ makes sets of database records available through the Recordset design-time control.

To add a Recordset control to an ASP or HTML page

  1. Make sure that you have set options to view controls graphically. From the View menu, choose View Controls Graphically. To set this option as default, use the HTML node of the Options dialog box.

  2. Open the ASP or HTML page in the editor. For information on creating ASP or HTML pages, see Creating Pages.

  3. Drag the Recordset control from the Design-Time Controls tab of the Toolbox onto the page.

    Tip   If the Recordset control is not shown in the Toolbox, right-click on the Toolbox, choose Customize Toolbox, and add the Recordset control.

You can now specify a set of records for the Recordset control.

To specify a set of records

  1. In the Recordset control on the ASP or HTML page, set the Connection property to the name of the data connection for the database whose records you want to see.

  2. Set the Database Object property to Table to display all the records in a table in the database. (You can also set this property to other sets of records in the database, such as a view or a stored procedure.)

  3. Set the Object Name property to the name of the table or other database object whose records you want to use.

For more information on the Recordset control and setting its properties, see Recordset Properties Dialog Box.

You can display data from this set of records by adding a data-bound control to your ASP or HTML page and setting the Recordset control as the control's data source. The control is then bound to the records in that table. For more information, see Displaying Records.

Note   You can also create data connections and add Recordset controls to your Visual InterDev project using the data environment. The data environment is especially valuable if you want the ability to programmatically manage your data and recordsets in one location. For more information, see Viewing Data and The Data Environment.

Note   Visual InterDev allows you to take advantage of Microsoft® Internet Explorer 4.0's client-side data binding, as well as the more traditional server-side data binding. For a discussion of client-side data binding, see Data Binding.