Storages & Files Read method
Read method

Reads the record from the current position in the stream and leaves the current position after it. Appropriate for sequential access to the stream, applicable for streams that do not support seek operations (all the streams in this library are seekable, but also external streams can be used with the SFRecord object).

Syntax:

variable = record_object.Read

Parameters:

variable - Boolean value - True if successful, False if not successful or if the end of stream has been reached.

Examples:

While rec.Read
  Response.Write rec("field1") & ", " & rec("field2") & "<BR>"
Wend
' Reads all the records up to the end of the stream.
Set sf = Server.CreateObject("newObjects.utilctls.SFMain")
Set file = sf.OpenFile(Server.MapPath("fillw.rec"),&H40)
Set rec = Server.CreateObject("newObjects.utilctls.SFRecord")
rec.AddField "Field1", vbString, 20
rec.AddField "Field2", vbLong
rec.BindTo file

While Not file.EOS
  rec.Read
  Response.Write "Read a record: Field1=" & rec("Field1").Value & " ,Field2=" & rec("Field2").Value & "<BR>"
Wend
rec.UnBind
' Reading the contents of the file sequentially

Remarks:

Read and Write methods are alternative to the Move, ReRead and Update methods. The requirements of the Read and Write methods are lower thus they can be used with streams that do not support all the standard stream operations. This is useful especially for streams not implemented in this library - when the application accesses a stream returned form a 3-d party object or application with some features missing (non-seekable for example).

The record must be bound to the stream.

Applies to: SFRecord object

See also: Write

Supported on:

Windows 95/NT and later
Windows CE 3.0 and later
Pocket PC/Windows Mobile 2003 and later
Windows CE.NET 4 and later

 

newObjects Copyright 2001-2006 newObjects [ ]