ADO.NET Provider for PingOne

Build 25.0.9434

DELETE Statements

To delete information from a table, use DELETE statements.

DELETE Syntax

The DELETE statement requires the table name in the FROM clause and the row's primary key in the WHERE clause, as shown in the following example:

<delete_statement> ::= DELETE FROM <table_name> WHERE { Id = <expression> } [ { AND | OR } ... ]

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

You can use the ExecuteNonQuery method to execute data manipulation commands and retrieve the number of affected rows, as shown in the following example:

C#

String connectionString = "AuthScheme=OAuth;InitiateOAuth=GETANDREFRESH;WorkerAppEnvironmentId=eebc33a8-xxxx-4f3a-yyyy-d3e5262fd49e;Region=NA;OAuthClientId=client_id;OAuthClientSecret=client_secret;";
using (PingOneConnection connection = new PingOneConnection(connectionString)) {
  int rowsAffected;
  PingOneCommand cmd = new PingOneCommand("DELETE FROM [CData].[Administrators].Users WHERE Id = @myId", connection);
  cmd.Parameters.Add(new PingOneParameter("myId","39ef9b6f-5973-4701-bd19-7950d4b7d6e0"));
  rowsAffected = cmd.ExecuteNonQuery();
}

VB.NET

  
Dim connectionString As [String] = "AuthScheme=OAuth;InitiateOAuth=GETANDREFRESH;WorkerAppEnvironmentId=eebc33a8-xxxx-4f3a-yyyy-d3e5262fd49e;Region=NA;OAuthClientId=client_id;OAuthClientSecret=client_secret;"
Using connection As New PingOneConnection(connectionString)
  Dim rowsAffected As Integer
  Dim cmd As New PingOneCommand("DELETE FROM [CData].[Administrators].Users WHERE Id = @myId", connection)
  cmd.Parameters.Add(New PingOneParameter("myId", "39ef9b6f-5973-4701-bd19-7950d4b7d6e0"))
  rowsAffected = cmd.ExecuteNonQuery()
End Using

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