Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: SQL
Expertise: Beginner
Mar 21, 1997



Application Security Testing: An Integral Part of DevOps

I want to retrieve data from a database that is not associated with any objects

I want to retrieve data from a database that is not associated with any objects on a form. How do I do this?

A recordset is a client-side mechanism for holding retrieved data that is automatically created for each bound container in a Power Objects application. Power Objects allow you to dynamically create recordsets that are not connected with any containers.

To create a standalone recordset, you first create an object variable to hold the reference to the recordset and then use the NEW DBRECORDSET command to create the recordset. The session that will be used for the recordset is indicated as a parameter of the command.

Once the recordset is created, you can specify the data you want from a database by using the SetQuery() method. The SetQuery() method is associated the recordset with a database session object with the standard do reference. The first parameter assigns an SQL statement that will be used to define the recordset and the second parameter is a boolean that indicates whether the recordset will be updateable. OPO will set up columns in the recordset to correspond to the columns in the SQL statement.

To actually retrieve data, you use the Requery() function, which is NOT in the Power Objects version 1 documentation. The Requery() function causes the SQL statement to be sent to the designated server and the return of data, if appropriate.

The complete code sequence for using a standalone recordset is:

       DIM objRecSet As Object
       DIM sSQL As String
       objRecSet.SetQuery( sSQL, FALSE)


Once you have created a standalone recordset, you can use any of the standard recordset methods with it, such as GetColVal() or InsertRow(). It's often easier to use standalone recordsets than to use the EXEC SQL function.

DevX Pro
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.
Thanks for your registration, follow us on our social networks to keep up-to-date