Storages & Files Write
Write method

Writes the contents of the record to the stream and remains on the resulting position - i.e. the position after the operation is the next record. 


variable = object.Write


returned value: Boolean success indicator


Set sf = Server.CreateObject("newObjects.utilctls.SFMain")
Set file = sf.CreateFile(Server.MapPath("fillw.rec"))
Set rec = Server.CreateObject("newObjects.utilctls.SFRecord")
rec.AddField "Field1", vbString, 20
rec.AddField "Field2", vbLong
rec.BindTo file

For I = 1 To 10
  rec("Field1").Value = "Value " & I
  rec("Field2").Value = I
  Response.Write "Writing record " & I & "<BR>"


It will be helpful to compare the sample above with the sample in the Update method's page.

Write method needs no "seek" (re-positioning operations). Therefore it will work on any stream - no matter if it is seekable or non-seekable. This allows the SFRecord to be used with streams which support only basic stream features. All the streams in this library are seekable and this concerns only stream functionality supplied by external components and applications.

As it can be seen using Write method instead of update requires a bit less code and is perfect for initial stream filling operations. For example a filter/converter application, for example a script that imports a DB table into stream, may prefer the Write method which will simplify its code. 

Applies to: SFRecord object

See also: Read

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 [ ]