OracleRowUpdatedEventArgs Classe
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Fournit des données pour l'événement RowUpdated. Cette classe ne peut pas être héritée.
public ref class OracleRowUpdatedEventArgs sealed : System::Data::Common::RowUpdatedEventArgs
public sealed class OracleRowUpdatedEventArgs : System.Data.Common.RowUpdatedEventArgs
type OracleRowUpdatedEventArgs = class
inherit RowUpdatedEventArgs
Public NotInheritable Class OracleRowUpdatedEventArgs
Inherits RowUpdatedEventArgs
- Héritage
Exemples
L’exemple suivant montre comment utiliser les événements et RowUpdating les RowUpdated événements.
L’événement RowUpdating retourne cette sortie :
Event Arguments: (command=OracleCommand commandType=2status=0)
L’événement RowUpdated retourne cette sortie :
Event Arguments: (command= OracleCommend commandType=2 recordsAffected=1 row=System.Data.DataRow[37] status=0)
// handler for RowUpdating event
private static void OnRowUpdating(object sender, OracleRowUpdatingEventArgs e) {
PrintEventArgs(e);
}
//Handler for RowUpdated event.
private static void OnRowUpdated(object sender, OracleRowUpdatedEventArgs e) {
PrintEventArgs(e);
}
public static int Main(String[] args) {
const string CONNECTION_STRING = "Data Source=Oracle8i;Integrated Security=yes";
const string SELECT_ALL = "SELECT * FROM Scott.Emp";
//Create DataAdapter.
OracleDataAdapter rAdapter = new OracleDataAdapter(SELECT_ALL, CONNECTION_STRING);
OracleCommandBuilder cb = new OracleCommandBuilder(rAdapter);
//Create and fill DataSet (Select only first 5 rows.).
DataSet rDataSet = new DataSet();
rAdapter.Fill(rDataSet, 0, 5, "Table");
//Modify DataSet.
DataTable rTable = rDataSet.Tables["Table"];
rTable.Rows[0][1] = "DYZY";
//Add handlers.
rAdapter.RowUpdating += new OracleRowUpdatingEventHandler( OnRowUpdating );
rAdapter.RowUpdated += new OracleRowUpdatedEventHandler( OnRowUpdated );
//Update--this operation fires two events (RowUpdating and RowUpdated) for each changed row.
rAdapter.Update(rDataSet, "Table");
//Remove handlers.
rAdapter.RowUpdating -= new OracleRowUpdatingEventHandler( OnRowUpdating );
rAdapter.RowUpdated -= new OracleRowUpdatedEventHandler( OnRowUpdated );
return 0;
}
private static void PrintEventArgs(OracleRowUpdatingEventArgs args) {
Console.WriteLine("OnRowUpdating");
Console.WriteLine(" event args: ("+
" command=" + args.Command +
" commandType=" + args.StatementType +
" status=" + args.Status + ")");
}
private static void PrintEventArgs(OracleRowUpdatedEventArgs args) {
Console.WriteLine("OnRowUpdated");
Console.WriteLine( " event args: ("+
" command=" + args.Command +
" commandType=" + args.StatementType +
" recordsAffected=" + args.RecordsAffected +
" status=" + args.Status + ")" );
}
'Handler for RowUpdating event.
Private Shared Sub OnRowUpdating(sender As Object, e As OracleRowUpdatingEventArgs)
PrintEventArgs(e)
End Sub
'Handler for RowUpdated event.
Private Shared Sub OnRowUpdated(sender As Object, e As OracleRowUpdatedEventArgs)
PrintEventArgs(e)
End Sub
'Entry point which delegates to C-style main Private Function.
Public Overloads Shared Sub Main()
System.Environment.ExitCode = Main(System.Environment.GetCommandLineArgs())
End Sub
Overloads Public Shared Function Main(args() As String) As Integer
Const CONNECTION_STRING As String = "Data Source=Oracle8i;Integrated Security=yes"
Const SELECT_ALL As String = "SELECT * FROM Scott.Emp"
'Create DataAdapter.
Dim rAdapter As New OracleDataAdapter(SELECT_ALL, CONNECTION_STRING)
Dim cb As New OracleCommandBuilder(rAdapter)
'Create and fill DataSet (Select only first 5 rows.).
Dim rDataSet As New DataSet()
rAdapter.Fill(rDataSet, 0, 5, "Table")
'Modify DataSet.
Dim rTable As DataTable = rDataSet.Tables("Table")
rTable.Rows(0)(1) = "DYZY"
'Add handlers.
AddHandler rAdapter.RowUpdating, AddressOf OnRowUpdating
AddHandler rAdapter.RowUpdated, AddressOf OnRowUpdated
'Update--this operation fires two events (RowUpdating and RowUpdated) for each changed row.
rAdapter.Update(rDataSet, "Table")
'Remove handlers.
RemoveHandler rAdapter.RowUpdating, AddressOf OnRowUpdating
RemoveHandler rAdapter.RowUpdated, AddressOf OnRowUpdated
Return 0
End Function 'Main
Overloads Private Shared Sub PrintEventArgs(args As OracleRowUpdatingEventArgs)
Console.WriteLine("OnRowUpdating")
Console.WriteLine(" event args: (" & " command=" & args.Command.CommandText & _
" commandType=" & args.StatementType & " status=" & args.Status & ")")
End Sub
Overloads Private Shared Sub PrintEventArgs(args As OracleRowUpdatedEventArgs)
Console.WriteLine("OnRowUpdated")
Console.WriteLine(" event args: (" & " command=" & args.Command.CommandText & _
" commandType=" & args.StatementType & " recordsAffected=" & _
args.RecordsAffected & " status=" & args.Status & ")")
End Sub
End Class
Remarques
L’événement RowUpdated est déclenché lorsqu’une Update ligne est terminée.
Lors de l’utilisation Update, il existe deux événements qui se produisent pour chaque ligne de données mise à jour. L’ordre d’exécution est le suivant :
Les valeurs de l'DataRow sont déplacées vers les valeurs de paramètre.
L'événement OnRowUpdating est déclenché.
La commande s’exécute.
Si la commande est définie sur
FirstReturnedRecord, le premier résultat retourné est placé dans le DataRow.S’il existe des paramètres de sortie, ils sont placés dans le DataRow.
L'événement OnRowUpdated est déclenché.
AcceptChanges est appelé.
Constructeurs
| Nom | Description |
|---|---|
| OracleRowUpdatedEventArgs(DataRow, IDbCommand, StatementType, DataTableMapping) |
Initialise une nouvelle instance de la classe OracleRowUpdatedEventArgs. |
Propriétés
| Nom | Description |
|---|---|
| Command |
Obtient ou définit l’exécution OracleCommand lorsqu’elle Update(DataSet) est appelée. |
| Errors |
Obtient toutes les erreurs générées par le fournisseur de données .NET lorsque le Command a été exécuté. (Hérité de RowUpdatedEventArgs) |
| RecordsAffected |
Obtient le nombre de lignes modifiées, insérées ou supprimées par l’exécution de l’instruction SQL. (Hérité de RowUpdatedEventArgs) |
| Row |
Obtient l’envoi DataRow par le biais d’un Update(DataSet). (Hérité de RowUpdatedEventArgs) |
| RowCount |
Obtient le nombre de lignes traitées dans un lot d’enregistrements mis à jour. (Hérité de RowUpdatedEventArgs) |
| StatementType |
Obtient le type d’instruction SQL exécuté. (Hérité de RowUpdatedEventArgs) |
| Status |
Obtient la UpdateStatusCommand propriété. (Hérité de RowUpdatedEventArgs) |
| TableMapping |
Obtient l’envoi DataTableMapping par le biais d’un Update(DataSet). (Hérité de RowUpdatedEventArgs) |
Méthodes
| Nom | Description |
|---|---|
| CopyToRows(DataRow[], Int32) |
Copie les références aux lignes modifiées dans le tableau fourni. (Hérité de RowUpdatedEventArgs) |
| CopyToRows(DataRow[]) |
Copie les références aux lignes modifiées dans le tableau fourni. (Hérité de RowUpdatedEventArgs) |
| Equals(Object) |
Détermine si l’objet spécifié est égal à l’objet actuel. (Hérité de Object) |
| GetHashCode() |
Sert de fonction de hachage par défaut. (Hérité de Object) |
| GetType() |
Obtient la Type de l’instance actuelle. (Hérité de Object) |
| MemberwiseClone() |
Crée une copie superficielle du Objectactuel. (Hérité de Object) |
| ToString() |
Retourne une chaîne qui représente l’objet actuel. (Hérité de Object) |