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

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

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

To create a standalone recordset, you first create an object variableto hold the reference to the recordset and then use the NEWDBRECORDSET command to create the recordset. The session that willbe used for the recordset is indicated as a parameter of the command.

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

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

The complete code sequence for using a standalone recordset is:

       DIM objRecSet As Object       DIM sSQL As String       sSQL = "SELECT EMPNO, ENAME, HIREDATE FROM EMP"       objRecSet = NEW DBRECORDSET(MLDATA)       objRecSet.SetQuery( sSQL, FALSE)       objRecSet.Requery()    

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

Share the Post:
Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several

data fivetran pricing

Fivetran Pricing Explained

One of the biggest trends of the 21st century is the massive surge in analytics. Analytics is the process of utilizing data to drive future decision-making. With so much of

kubernetes logging

Kubernetes Logging: What You Need to Know

Kubernetes from Google is one of the most popular open-source and free container management solutions made to make managing and deploying applications easier. It has a solid architecture that makes