Query Method

This method updates replication information.

Syntax

ReplicationInstance.Query

Remarks

You must call this method before you can obtain accurate information about a ReplicationInstance object's properties.

Example

The following example displays the information on the completed replications for Proj1.

Option Explicit 
On Error Resume Next

const CRS_ERROR_NO_MORE_ITEMS  = 0&80003B17
const OPEN_EXISTING_PROJECT  = 2
const REPL_STATE_COMPLETE    = 3

Err.Clear

dim ReplServer
set ReplServer = CreateObject("CrsApi.ReplicationServer")
ReplServer.Initialize("")

dim ReplProject
set ReplProject = ReplServer.OpenProject("Proj1", OPEN_EXISTING_PROJECT)

dim Iterator
Iterator = 0
dim Inst

dim ID
ID = 0

do while True
  
  'Get replication instance
  set Inst = ReplProject.EnumReplications(REPL_STATE_COMPLETE, Iterator)

  'Quit if "No more items" error 
  if Err.Number = CRS_ERROR_NO_MORE_ITEMS then exit do
   
  'Quit if Instance is empty
  if IsEmpty(Inst) then
   Wscript.Echo "Instance object is empty."
   exit do
  end if

  'Quit if Instance is NULL
  if IsNull(Inst) then
   Wscript.Echo "Instance object is Null."
   exit do
  end if

  'Quit if we're looking at the same instance
  if ID = Inst.ID then exit do

  'Update Instance properties
  Inst.Query

  'Display Instance properties:
  Wscript.Echo "Replication " & Inst.Name & " had the following info:"
  Wscript.Echo ""
  Wscript.Echo "Bytes received:  " & Inst.BytesReceived
  Wscript.Echo "Bytes sent:    " & Inst.BytesSent
  Wscript.Echo "Files errored:   " & Inst.FilesErrored
  Wscript.Echo "Files errored bytes: " & Inst.FilesErroredBytes
  Wscript.Echo "Files matched:   " & Inst.FilesMatched
  Wscript.Echo "Files matched bytes: " & Inst.FilesMatchedBytes
  Wscript.Echo "Files sent:    " & Inst.FilesSent
  Wscript.Echo "Flags:     " & Inst.Flags
  Wscript.Echo "ID:      " & Inst.ID
  Wscript.Echo "Start time:    " & Inst.StartTime
  Wscript.Echo "End time:    " & Inst.EndTime
  Wscript.Echo "Status:      " & Inst.Status

  'Save Instance ID
  ID = Inst.ID

  'Release Instance object
set Inst = Nothing

Loop

'Release objects
set ReplProject = Nothing
set ReplServer  = Nothing

See Also

ID


© 1997-1998 Microsoft Corporation. All rights reserved.