VersionNotFoundException 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.
Représente l’exception levée lorsque vous essayez de retourner une version d’un DataRow qui a été supprimée.
public ref class VersionNotFoundException : System::Data::DataException
[System.Serializable]
public class VersionNotFoundException : System.Data.DataException
public class VersionNotFoundException : System.Data.DataException
[<System.Serializable>]
type VersionNotFoundException = class
inherit DataException
type VersionNotFoundException = class
inherit DataException
Public Class VersionNotFoundException
Inherits DataException
- Héritage
- Attributs
Exemples
L’exemple suivant crée un DataTable objet avec un DataColumn et dix DataRow objets. Après la suppression d’un DataRow, la tentative de retour de la version actuelle de la ligne supprimée entraîne la levée d’une VersionNotFoundException exception.
private void DemonstrateVersionNotFoundException()
{
// Create a DataTable with one column.
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);
}
table.AcceptChanges();
try
{
Console.WriteLine("Trying...");
DataRow removedRow = table.Rows[9];
removedRow.Delete();
removedRow.AcceptChanges();
// Try to get the Current row version.
Console.WriteLine(removedRow[0,DataRowVersion.Current]);
}
catch(System.Data.VersionNotFoundException)
{
Console.WriteLine("Current version of row not found.");
}
}
Private Sub DemonstrateVersionNotFoundException()
' Create a DataTable with one column.
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
table.AcceptChanges()
Try
Console.WriteLine("Trying...")
Dim removedRow As DataRow = table.Rows(9)
removedRow.Delete()
removedRow.AcceptChanges()
' Try to get the Current row version.
Console.WriteLine(removedRow(0, DataRowVersion.Current))
Catch e As System.Data.VersionNotFoundException
Console.WriteLine("Current version of row not found.")
End Try
End Sub
Constructeurs
| Nom | Description |
|---|---|
| VersionNotFoundException() |
Initialise une nouvelle instance de la classe VersionNotFoundException. |
| VersionNotFoundException(SerializationInfo, StreamingContext) |
Initialise une nouvelle instance de la VersionNotFoundException classe avec des informations de sérialisation. |
| VersionNotFoundException(String, Exception) |
Initialise une nouvelle instance de la VersionNotFoundException classe avec un message d’erreur spécifié et une référence à l’exception interne qui est la cause de cette exception. |
| VersionNotFoundException(String) |
Initialise une nouvelle instance de la VersionNotFoundException classe avec la chaîne spécifiée. |
Propriétés
| Nom | Description |
|---|---|
| Data |
Obtient une collection de paires clé/valeur qui fournissent des informations supplémentaires définies par l’utilisateur sur l’exception. (Hérité de Exception) |
| HelpLink |
Obtient ou définit un lien vers le fichier d’aide associé à cette exception. (Hérité de Exception) |
| HResult |
Obtient ou définit HRESULT, valeur numérique codée affectée à une exception spécifique. (Hérité de Exception) |
| InnerException |
Obtient l’instance Exception qui a provoqué l’exception actuelle. (Hérité de Exception) |
| Message |
Obtient un message qui décrit l’exception actuelle. (Hérité de Exception) |
| Source |
Obtient ou définit le nom de l’application ou de l’objet qui provoque l’erreur. (Hérité de Exception) |
| StackTrace |
Obtient une représentation sous forme de chaîne des images immédiates sur la pile des appels. (Hérité de Exception) |
| TargetSite |
Obtient la méthode qui lève l’exception actuelle. (Hérité de Exception) |
Méthodes
| Nom | Description |
|---|---|
| Equals(Object) |
Détermine si l’objet spécifié est égal à l’objet actuel. (Hérité de Object) |
| GetBaseException() |
En cas de substitution dans une classe dérivée, retourne la Exception qui est la cause racine d’une ou plusieurs exceptions ultérieures. (Hérité de Exception) |
| GetHashCode() |
Sert de fonction de hachage par défaut. (Hérité de Object) |
| GetObjectData(SerializationInfo, StreamingContext) |
En cas de substitution dans une classe dérivée, définit l'SerializationInfo avec des informations sur l’exception. (Hérité de Exception) |
| GetType() |
Obtient le type d’exécution de l’instance actuelle. (Hérité de Exception) |
| MemberwiseClone() |
Crée une copie superficielle du Objectactuel. (Hérité de Object) |
| ToString() |
Crée et retourne une représentation sous forme de chaîne de l’exception actuelle. (Hérité de Exception) |
Événements
| Nom | Description |
|---|---|
| SerializeObjectState |
Se produit lorsqu’une exception est sérialisée pour créer un objet d’état d’exception qui contient des données sérialisées sur l’exception. (Hérité de Exception) |