Assembly : System.Data (dans system.data.dll)
Syntaxe<SerializableAttribute> _ Public Class RowNotInTableException Inherits DataException
Dim instance As RowNotInTableException
[SerializableAttribute] public class RowNotInTableException : DataException
[SerializableAttribute] public ref class RowNotInTableException : public DataException
/** @attribute SerializableAttribute() */ public class RowNotInTableException extends DataException
SerializableAttribute public class RowNotInTableException extends DataException
NotesRowNotInTableException est levé si vous appelez les méthodes suivantes sur une ligne qui a été supprimée à l'aide de la méthode Delete ou DataRowCollection.Remove.
ExempleL'exemple suivant crée un DataTable comportant un DataColumn et 10 objets DataRow. Après la suppression d'une ligne, la méthode AcceptChanges est appelée, ce qui entraîne la levée de RowNotInTableException.
Private Sub DemonstrateRowNotInTableException() ' Create a DataTable with one column and ten rows. Dim table As New DataTable("NewTable") Dim column As New DataColumn("NewColumn") table.Columns.Add(column) Dim newRow As DataRow Dim i As Integer For i = 0 To 9 newRow = table.NewRow() newRow("NewColumn") = i table.Rows.Add(newRow) Next i Try ' Remove a row and invoke AcceptChanges. Dim removedRow As DataRow = table.Rows(9) removedRow.Delete() removedRow.AcceptChanges() Catch rowException As System.Data.RowNotInTableException Console.WriteLine("Row not in table") End Try End Sub
private void DemonstrateRowNotInTableException() { // Create a DataTable with one column and ten rows. DataTable table = new DataTable("NewTable"); DataColumn column = new DataColumn("NewColumn"); table.Columns.Add(column); DataRow newRow; for(int i = 0;i <10;i++) { newRow = table.NewRow(); newRow["NewColumn"] = i; table.Rows.Add(newRow); } try { // Remove a row and invoke AcceptChanges. DataRow removedRow = table.Rows[9]; removedRow.Delete(); removedRow.AcceptChanges(); } catch(System.Data.RowNotInTableException rowException) { Console.WriteLine("Row not in table"); } }
Hiérarchie d'héritageSystem.Exception
System.SystemException
System.Data.DataException
System.Data.RowNotInTableException
Sécurité des threads
Plates-formesWindows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile pour Pocket PC, Windows Mobile pour Smartphone, Windows Server 2003, Windows XP Édition Media Center, Windows XP Professionnel Édition x64, Windows XP SP2, Windows XP Starter Edition
Le .NET Framework ne prend pas en charge toutes les versions de chaque plate-forme. Pour obtenir la liste des versions prises en charge, consultez Configuration requise.
Informations de version
Outils (masquer)
S'enregistrer
Liste des Membres
Qui est en ligne?
FAQ