BBjAPI::createSQLRecordSet

Description

In BBj 4.0 and higher, this method creates a BBjRecordSet bound to an SQL SELECT statement.

Syntax

Return Value

Method

BBjRecordSet

createSQLRecordSet(string connect, string modes, string select)

BBjRecordSet

createSQLRecordSet(string connect, string modes, string select, boolean scrollSensitive)

BBjRecordSet

createSQLRecordSet(string connect, string modes, string select, boolean scrollSensitive, boolean updatable)

Parameters

Variable

Description

connect

The connection string required to access an SQL database, equivalent to the JDBC connection string in the sql.ini file. A database name defined in sql.ini or config.ini can also be used here.

modes

SQL modes. This is the string that would be specified in the MODE=string option in a regular SQLOPEN command. For additional details, see SQLOPEN Verb - Open SQL Channel.

select

An SQL SELECT command.

scrollSensitive

In BBj 12.0 and higher, scroll sensitive true (1) displays live updates to the file while scrolling through the record set; false (0) takes a snapshot of the record set at the time the query is run. If using this with a grid, this must be set to false. The default is false.

updatable

In BBj 12.0 and higher, true (1) indicates the record set is updatable; false (0) prevents updates to the record set. The default is true.

Return Value

Returns an SQL-based BBjRecordSet object.

Remarks

None.

Example

REM ' createSQLRecordSet sample

REM ' Define the connection information
database$ = "ChileCompany"
table$ = "ITEM"
user$="admin"
password$="admin123"
modes$="user="+user$+",password="+password$
select$ = "select * from "+table$

REM ' Create the RecordSet
RecordSet! = BBJAPI().createSQLRecordSet(database$,modes$,select$)

REM ' Go to the first record
RecordSet!.first()

REM ' Retrieve the RecordData for the current record
RecordData! = RecordSet!.getCurrentRecordData()

REM ' Print the RecordData
print 'lf',"The first record of table ",table$," in database ",database$," is:"
print 'lf',RecordData!,

stop

See Also

BBjAPI

See the BBj Object Diagram for an illustration of the relationship between BBj Objects.



______________________________________________________________________________________

Copyright BASIS International Ltd. BBj®, Visual PRO/5®, PRO/5®, and BBx® are registered trademarks.