Please enable JavaScript to view this site.

thinBasic Help Manual

* * HELP & MANUAL PREMIUM PACK 4 DEMO VERSION * *

This documentation was styled with a demo skin from the Premium Pack 4 add-on for Help & Manual. The contents of the skin are encrypted and not configurable. You can only publish HM projects with this skin. You cannot edit it or change it.

This version is copyright and may only be used for local testing purposes. It may not be distributed.

Please purchase the full version of the Premium Pack to get the configurable skins and remove this notice. The package will also include the Toolbox configuration utility for Premium Pack skins.

 

Description

 
Opens a database element that gives you access to records in a table, the results of a query, or to a saved Recordset.

 

Syntax

 

<ADODB_Recordset>.Open (sSource, pConnection [, CursorType [, lLockType [, lCommandType]]])

 

Returns

 

None.

 

Parameters

 

Name

Type

Optional

Meaning

sSource

String

No

Specifies a data source.

The source parameter may be one of the following:

An SQL statement

A stored procedure

A table name

...

pConnection

Object

No

An ADODB_ Connection object

lCursorType

Numeric

Yes

A CursorTypeEnum value that specifies the type of cursor to use when opening a Recordset object.

 

Default is %adOpenForwardOnly

lLockType

Numeric

Yes

A LockTypeEnum value that specifies the type of locking on a Recordset object.

 

Default is %adLockReadOnly

lCommandType

Numeric

Yes

Specifies how to evaluate the source parameter. Can be one or more CommandTypeEnum.

 

Default is %adCmdUnknown

 

Remarks

 

Always Close the ADODB_Recordset object after using it, to free system resources

Use <ADODB_Recordset>.Close when finished to use a Recordset

 

Restrictions

 

See also

 

Examples

 

Uses "Console"

Uses "ADODB"

 

String sConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & APP_SourcePath & "Biblio.mdb"

 

'---Declare a new pConnection variable and instantiate it in one line

Dim pConn As New ADODB_CONNECTION '[(sConn)]

'---Set connection string

pConn.ConnectionString = sConn

'---Open connection. Connection string is taken from ConnectionString property

pConn.Open

 

If pConn.State = %ADSTATEOPEN Then

 

    Dim pRS   As New ADODB_RECORDSET

    Dim sSql  As String

  

    pRs.CursorLocation = %ADUSECLIENT

 

    sSql = "select * from Authors"

 

    '---

    PrintL "Query is:", sSql

 

    pRs.OPEN sSql, pConn, %ADOPENDYNAMIC%ADLOCKOPTIMISTIC%ADCMDTEXT

 

    If pRS.State = %ADSTATEOPEN Then

      '---Do something with the Recordset

      PrintL "Records found", pRs.RecordCount

 

      '---...

 

      '---Close recordset

      PrintL "  pRecordSet.Close         :", pRS.CLOSE

    else

      '---Something Wrong the Recordset

      PrintL "  Something wrong with the recordset"

    End If

 

    '---Close Connection

    PrintL "  pConnection.Close        :", pConn.CLOSE

 

Else

      PrintL "-It was not possible to open a connection-" In %CCOLOR_FLIGHTRED

End If

 

PrintL "---Press a key to finish---"

WaitKey

 

Created with Help+Manual 8 and styled with Premium Pack Version 4 © by EC Software