|
Sets or returns the contents of a control's current record buffer. The record buffer is the raw record data retrieved by Pervasive.SQL.
The Buffer property syntax has these parts:
Data is read from and written to the current record buffer. On a read operation, this property returns an OLE Variant containing a byte array representation of the current record buffer. On a write operation, it takes an OLE Variant which contains a byte array to be written to the current record buffer. Changes made to this property are not saved in the Btrieve file until a successful Update or Insert method is invoked.
The buffer that is returned is the single record buffer only; it will not contain the contents of the status buffer after a Stat call, nor will it contain an extended operations record buffer after an extended operations call. This information is available through other properties and methods (see Stat, RowColumnValue, and RowPosition). The Clear method will clear this buffer.
Certain programming environments allow or require specific byte alignment for structured variables. The alignment parameter enables you to specify the byte alignment to be used for individual fields within the record.
This property is not available at design time.
Public Type SAFEARRAYBOUNDS cElements As Long lLbound As Long End Type Public Type SAFEARRAY cDims As Integer fFeatures As Integer cbElements As Long cLocks As Long pvData As Long Bounds(0) As SAFEARRAYBOUNDS End Type Public Type Buffer msa_desc As String * 34 population As Long prev_population As Long End Type Declare Sub CopyMemory Lib "KERNEL32" Alias _ "RtlMoveMemory" (pDest As Any, pSrc As Any, ByVal _ ByteLen As Long) Declare Function VarPtrArray Lib "msvbvm50.dll" _ Alias "VarPtr" (Ptr() As Any) As Long Public Sub ReadData() Dim i as integer Dim dataArray() as Buffer Dim byteArray() as Byte VAccess1.Open VAccess1.GetFirst Redim dataArray(VAccess1.TotalRecords) For i = 0 to VAccess1.TotalRecords-1 ByteArray = VAccess1.Buffer(4) DataArray(i) = GetBuffer(byteArray) VAccess1.GetNext Next i End Sub Public Function GetBuffer(bufferArray() As Byte) _ as Buffer Dim status As Integer Dim saPtr As Long Dim saStruct As SAFEARRAY Dim record as Buffer 'get the address of safearray structure CopyMemory saPtr, ByVal VarPtrArray(bufferArray),_ 4 'copy the safearray structure CopyMemory saStruct, ByVal saPtr, Len(saStruct) 'copy the data array into our structure CopyMemory record, ByVal saStruct.pvData, BufferSize(saStruct) GetBuffer = record End Function
Affected by: Clear, GetDirect, GetEqual, GetGreaterOrEqual, GetLessOrEqual, GetFirst, GetPrevious, GetNext, GetLast, StepFirst, StepPrevious, StepNext, StepLast, Percentage.
|
Chapter contents
Prev topic: AutoOpen
|