Select
Opens a database connection and selects a record set using using the
scope defined by the scope object and
sorted according to the sort object. This
method should be called before calls are made to any navigation methods and
most of the data access methods. The current position is set to the top record
if the method succeeds and there are records in the resulting record set.
Function Select( param (optional
) )
Parameters:
string param - set param to
"append" to request fast record insertion, append only
can be done in this mode(write only record set).
Return value:
boolean - true: the record set was opened
successfully and there are records in the record set; false: the
record set was opened successfully, but the record set is empty.
An exception is thrown in case of errors.
VB
Sample
' Sample
1
Dim val
If DB.Select() Then
Do
val = DB.GetCellVaue( "Field1" )
Loop While( DB.GoNext() )
End If
' Sample
2
DB.Select( "append" )
For I = 1 To 1000
DB.AppendStart()
DB.SetCellVaue "Field1", I
DB.AppendFinish()
Next
GoTop
Moves the current record position to the first record. Select must be called before this method is used.
Function GoTop()
Parameters:
none
Return value:
boolean - true: operation succeeded; false:
no records in the record set.
An exception is thrown in case of errors.
VB
Sample
Dim first_val, last_val
If DB.Select() Then
DB.GoBottom()
last_val = DB.GetCellVaue( "Field1" )
DB.GoTop()
first_val = DB.GetCellVaue( "Field1" )
End If
GoNext
Moves the current record position to the next record. Returns
false if there is no record to move to. Select must be called before this method is used.
Function GoNext()
Parameters:
none
Return value:
boolean - true: operation succeeded; false:
no records in the record set or the current position is the last
record.
An exception is thrown in case of errors.
VB
Sample
Dim val
If DB.Select() Then
Do
val = DB.GetCellVaue( "Field1" )
Loop While( DB.GoNext() )
End If
GoPrevious
Moves the current record position to the previous record. Returns
false if there is no record to move to. Select must be called before this method is used.
Function GoPrevious()
Parameters:
none
Return value:
boolean - true: operation succeeded; false:
no records in the record set or the current position is at the first
record.
An exception is thrown in case of errors.
VB
Sample
Dim val
If DB.Select() Then
DB.GoBottom()
Do
val = DB.GetCellVaue( "Field1" )
Loop While( DB.GoPrevious() )
End If
GoBottom
Moves the current record position to the last record in the record
set. Select must be called before this method is
used.
Function GoBottom()
Parameters:
none
Return value:
boolean - true: operation succeeded; false:
no records in the record set.
An exception is thrown in case of errors.
VB
Sample
Dim first_val, last_val
If DB.Select() Then
DB.GoBottom()
last_val = DB.GetCellVaue( "Field1" )
DB.GoTop()
first_val = DB.GetCellVaue( "Field1" )
End If
GoRandom
Moves the current record position to the record identified by
the record number that is passed to GoRandom as a parameter.
Returns false if the record number parameter is less than 0
or greater than GetRecordCount - 1.
Select should be called prior to this
method.
Function GoBottom( rec_num )
Parameters:
integer rec_num - a zero-based record position
to set the current record position to; range: from 0 to GetRecordCount - 1
Return value:
boolean - true: operation succeeded; false:
no records in the record set.
An exception is thrown in case of errors.
VB
Sample
If DB.Select() Then
For I = 0 To 999
DB.GoRandom( I )
DB.GetCellVaue( "Field1" )
Next
End If