ADO.NET Provider for Vault CRM

Build 25.0.9434

GETDELETED Statements

You can issue the GETDELETED query to retrieve all records deleted from the live data for the time range specified. This query accepts a datetime value as a filter, as shown in the following example:

GETDELETED FROM <table_name> WHERE <search_condition>

<search_condition> ::= 
  {
    <expression> { = | < | <= | > | >= } [ <expression> ] 
  } [ { AND | OR } ... ]

<expression> ::=
  | @ <parameter> 
  | ?
  | <literal>
  

C#

String connectionString = "Url=myURL;User=myUser;Password=myPassword;";
using (VaultCRMConnection connection = new VaultCRMConnection(connectionString)) {
  VaultCRMCommand cmd = new VaultCRMCommand("GETDELETED FROM Users WHERE TimeModified >= '2013-01-01'", connection); 
  VaultCRMDataReader rdr = cmd.ExecuteReader();
  while (rdr.Read()) {
    Console.WriteLine(rdr["Id"].ToString());
  }
}

VB.NET

Dim connectionString As [String] = "Url=myURL;User=myUser;Password=myPassword;"
Using connection As New VaultCRMConnection(connectionString)
  Dim cmd As New VaultCRMCommand("GETDELETED FROM Users WHERE TimeModified >= '2013-01-01'", connection)
  Dim rdr As VaultCRMDataReader = cmd.ExecuteReader()
  While rdr.Read()
    Console.WriteLine(rdr("Id").ToString())
  End While
End Using
Note: By putting a CACHE command in front of the query, you can update the cache to remove all values that have been deleted from the data source, as shown in the following example:
CACHE GETDELETED FROM [TableName] WHERE TimeModified >= '2013-01-01' AND TimeModified <= '2013-02-01'

Copyright (c) 2025 CData Software, Inc. - All rights reserved.
Build 25.0.9434