Reads an item from the D3 file associated with the clsD3File object, returning a clsD3DynamicArray object.
Set oDynArray = object.brRead( sItemName, [ vColumn], [ bLocking])
Parameter | Description |
---|---|
odynArray | An object variable that represents a clsD3DynamicArray object containing the data read from the D3 file. |
object | An object variable that represents a clsD3File object. |
sItemName | A String specifying the item-id of the item to read. |
vColumn | Optional and not recommended. Provided only for legacy applications. A Variant specifying either the attribute-defining item or the attribute number to be returned. If not specified or -1, then the entire item is returned. Note: To read a specific attribute
from an item in a D3 file, we recommend using the brReadV or brReadVU method.
|
bLocking | Optional and not recommended. Provided only for legacy applications. A constant indicating whether the item is locked during the read, as specified in Settings. The default is d3Item_ReadNoLock indicating no locking. Note: To read an item from the D3 file
with locking, we recommend using the brReadV method.
|
If no data is found referenced by sItemName, this method raises the exception d3SrvErr_Access.
Sub ReadItem_Click() Dim oEnv As clsD3Environment Dim oConn1 As clsD3Connection Dim oItem As New clsD3DynamicArray Dim oFile As clsD3File Set oEnv = New clsD3Environment Set oConn1 = oEnv.brOpenConnection("ODBC", "production") Set oFile = oConn1.brOpenFile("products") On Error GoTo D3ErrorHandler ' Item-id is read from a text box Set oItem = oFile.brRead(Text1.Text) oItem.brConvert D3AMChr, " " ' Display the item in a text box Text2.Text = oItem.brCString oConn1.brCloseFile oFile oEnv.brCloseConnection oConn1 Set oItem = Nothing Set oEnv = Nothing Exit Sub D3ErrorHandler: Select Case Err.Number Case d3SrvErr_Access oItem.brCString = "Item not found" Case Else oItem.brCString = "Unrecognizable error" End Select Resume Next End Sub
read