ADO.NET Provider for NetSuite

Build 23.0.8839

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 = "AccountId=XABC123456;Schema=SuiteTalk;AuthScheme=Token;OAuthClientId=MyOAuthClientId;OAuthClientSecret=MyOAuthClientSecret;OAuthAccessToken=MyOAuthAccessToken;OAuthAccessTokenSecret=MyOAuthAccessTokenSecret;";
using (NetSuiteConnection connection = new NetSuiteConnection(connectionString)) {
  NetSuiteCommand cmd = new NetSuiteCommand("GETDELETED FROM Account WHERE LastModifiedDate >= '2013-01-01'", connection); 
  NetSuiteDataReader rdr = cmd.ExecuteReader();
  while (rdr.Read()) {
    Console.WriteLine(rdr["InternalId"].ToString());
  }
}

VB.NET

Dim connectionString As [String] = "AccountId=XABC123456;Schema=SuiteTalk;AuthScheme=Token;OAuthClientId=MyOAuthClientId;OAuthClientSecret=MyOAuthClientSecret;OAuthAccessToken=MyOAuthAccessToken;OAuthAccessTokenSecret=MyOAuthAccessTokenSecret;"
Using connection As New NetSuiteConnection(connectionString)
  Dim cmd As New NetSuiteCommand("GETDELETED FROM Account WHERE LastModifiedDate >= '2013-01-01'", connection)
  Dim rdr As NetSuiteDataReader = cmd.ExecuteReader()
  While rdr.Read()
    Console.WriteLine(rdr("InternalId").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 LastModifiedDate >= '2013-01-01' AND LastModifiedDate <= '2013-02-01'

Copyright (c) 2024 CData Software, Inc. - All rights reserved.
Build 23.0.8839