brOpenFile method

Creates a new instance of a clsD3File class and opens the specified D3 file within the database.

Note: See the Remarks section for RPC and ODBC connection exceptions.

Syntax

Set oFile = object.brOpenFile( sRequired, [ sOptional])

Parameters

Parameter Description
oFile An object variable that represents a clsD3File object to be created.
object An object variable that represents a clsD3Connection object.
sRequired A String providing the a D3 file reference.
sOptional Optional. A String provided for compatibility with FlashBASIC syntax. When using this parameter, sRequired would contain either "Dict" or "", and this parameter would contain the filename.

Remarks

The following two lines of code are identical in functionality, opening the dictionary only of the customers file:

Set oFile1 = oConn. brOpenFile( "Dict customers ")
Set oFile2 = oConn. brOpenFile( "Dict ", "customers ")

The following two lines of code are identical in functionality, opening the dictionary and datalevel of the customers file:

Set oFile1 = oConn. brOpenFile( "customers ")
Set oFile2 = oConn. brOpenFile( "", "customers ")

The following two lines of code are identical in functionality, opening the dictionary of the customers file and the datalevel, current:

Set oFile1 = oConn. brOpenFile( "customers,current ")
Set oFile2 = oConn. brOpenFile( "", "customers,current ")

Example

Sub Main()
   Dim oEnv As New clsD3Environment
   Dim oConn As clsD3Connection
   Dim oFile As clsD3File
   Dim oArray As clsD3DynamicArray
   Dim lName As Long
   Dim lTitle As Long
 
   Set oConn = oEnv.brOpenConnection("ODBC;", "Production") 
 
   ' Open the file.
   Set oFile = oConn.brOpenFile("Customers")
 
   ' Resolve attribute names
   lName = oFile.brAttribute("contactname")
   lTitle = oFile.brAttribute("contacttitle")
 
   ' Read the record for customer "13".
   Set oArray = oFile.brReadU("13")
 
   ' Change the attributes in the dynamic array.
   oArray.brReplaceStr "Bob Smith", lName
   oArray.brReplaceStr "Vice President", lTitle
 
   ' Write the record back.
   oFile.brWrite oArray, "13"
   oConn.brCloseFile oFile
   oEnv.brCloseConnection oConn
   Set oEnv = Nothing
End Sub

FlashBASIC reference

open