Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • The DS_EQUATES $Insert Record.  This This record contains a list of codes that can be passed to the DSGetProperty(), DSSetProperty(), and DSMethod() to control in detail the communication between the BASIC+ program and the external database.

  • Creating a Data Set instance. After the connection has been established, the original program created an instance of a query object using QryInstance().  In In this example, we will create an instance of a data set object using DSInstance().  Both Both functions require a valid connection handle.  After After creating a data set instance, its properties and methods are available, just as the query object's properties and methods were available before.  The The code is:

Code Block
hDS = DSInstance('CUSTOMERS_NWIND', hXO)
  • Executing the SQL SelectThe code below executes the data set object's default script (the SQL SELECT script, which is what we want).  There There is no need to build the script in code because it is stored in the Data Set object.

Code Block
flag = DSMethod(hDS, DS_EXECUTE$)
  • Retrieving the Results.  Instead Instead of a loop, one line of code retrieves all of the results.  The The DSGetProperty() call, passing the DS_RECORD$ argument, returns all the records in a record mark delimited variable.  This This is the line of code: 

Code Block
rv = DSGetProperty(hDS, DS_RECORD$, results)
  • Destroying the instance.  Just Just as the query instance needed to be destroyed, the data set instance also must be destroyed, to preserve memory.  A A DSMethod() call exists for this purpose.  The The code is:

Code Block
DSMethod(hDS, DS_DESTROY$)
  •  Converting record mark delimiters to field marks.   This  This is needed because the combo box requires a field mark delimited variable.  This This is the code:

Code Block
convert @rm to @fm in results