RowNotInTableException Klasa
Definicja
public ref class RowNotInTableException : System::Data::DataException
public class RowNotInTableException : System.Data.DataException
[System.Serializable]
public class RowNotInTableException : System.Data.DataException
type RowNotInTableException = class
inherit DataException
[<System.Serializable>]
type RowNotInTableException = class
inherit DataException
Public Class RowNotInTableException
Inherits DataException
- Dziedziczenie
- Atrybuty
Przykłady
Poniższy przykład tworzy DataTable z jednym DataColumn i 10 DataRow obiektami.The following example creates a DataTable with one DataColumn and 10 DataRow objects. Po usunięciu wiersza AcceptChanges wywoływana jest metoda powodująca RowNotInTableException zgłaszanie.After deleting a row, the AcceptChanges method is called causing the RowNotInTableException to be thrown.
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");
}
}
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
Uwagi
RowNotInTableExceptionJest zgłaszany podczas wywoływania następujących metod w wierszu, który został usunięty z Delete lub DataRowCollection.Remove metodą.The RowNotInTableException is thrown when invoking the following methods on a row that has been deleted with either the Delete or the DataRowCollection.Remove method.
Konstruktory
RowNotInTableException() |
Inicjuje nowe wystąpienie klasy RowNotInTableException.Initializes a new instance of the RowNotInTableException class. |
RowNotInTableException(SerializationInfo, StreamingContext) |
Inicjuje nowe wystąpienie RowNotInTableException klasy z informacjami o serializacji.Initializes a new instance of the RowNotInTableException class with serialization information. |
RowNotInTableException(String) |
Inicjuje nowe wystąpienie RowNotInTableException klasy z określonym ciągiem.Initializes a new instance of the RowNotInTableException class with the specified string. |
RowNotInTableException(String, Exception) |
Inicjuje nowe wystąpienie RowNotInTableException klasy z określonym komunikatem o błędzie i odwołaniem do wyjątku wewnętrznego, który jest przyczyną tego wyjątku.Initializes a new instance of the RowNotInTableException class with a specified error message and a reference to the inner exception that is the cause of this exception. |
Właściwości
Data |
Pobiera kolekcję par klucz/wartość, które zawierają dodatkowe informacje zdefiniowane przez użytkownika dotyczące wyjątku.Gets a collection of key/value pairs that provide additional user-defined information about the exception. (Odziedziczone po Exception) |
HelpLink |
Pobiera lub ustawia link do pliku pomocy skojarzonego z tym wyjątkiem.Gets or sets a link to the help file associated with this exception. (Odziedziczone po Exception) |
HResult |
Pobiera lub ustawia wartość HRESULT, kodowane wartości liczbowe przypisane do określonego wyjątku.Gets or sets HRESULT, a coded numerical value that is assigned to a specific exception. (Odziedziczone po Exception) |
InnerException |
Pobiera Exception wystąpienie, które spowodowało bieżący wyjątek.Gets the Exception instance that caused the current exception. (Odziedziczone po Exception) |
Message |
Pobiera komunikat, który opisuje bieżący wyjątek.Gets a message that describes the current exception. (Odziedziczone po Exception) |
Source |
Pobiera lub ustawia nazwę aplikacji lub obiekt, który powoduje błąd.Gets or sets the name of the application or the object that causes the error. (Odziedziczone po Exception) |
StackTrace |
Pobiera ciąg reprezentujący bezpośrednie ramki w stosie wywołań.Gets a string representation of the immediate frames on the call stack. (Odziedziczone po Exception) |
TargetSite |
Pobiera metodę, która zgłasza bieżący wyjątek.Gets the method that throws the current exception. (Odziedziczone po Exception) |
Metody
Equals(Object) |
Określa, czy dany obiekt jest taki sam, jak bieżący obiekt.Determines whether the specified object is equal to the current object. (Odziedziczone po Object) |
GetBaseException() |
Gdy jest zastępowany w klasie pochodnej, zwraca wartość Exception będącą główną przyczyną jednego lub kilku kolejnych wyjątków.When overridden in a derived class, returns the Exception that is the root cause of one or more subsequent exceptions. (Odziedziczone po Exception) |
GetHashCode() |
Służy jako domyślna funkcja skrótu.Serves as the default hash function. (Odziedziczone po Object) |
GetObjectData(SerializationInfo, StreamingContext) |
Gdy jest zastępowany w klasie pochodnej, ustawia SerializationInfo Informacje o wyjątku.When overridden in a derived class, sets the SerializationInfo with information about the exception. (Odziedziczone po Exception) |
GetType() |
Pobiera typ środowiska uruchomieniowego bieżącego wystąpienia.Gets the runtime type of the current instance. (Odziedziczone po Exception) |
MemberwiseClone() |
Tworzy skróconą kopię bieżącego elementu Object .Creates a shallow copy of the current Object. (Odziedziczone po Object) |
ToString() |
Tworzy i zwraca reprezentację ciągu bieżącego wyjątku.Creates and returns a string representation of the current exception. (Odziedziczone po Exception) |
Zdarzenia
SerializeObjectState |
Występuje, gdy wyjątek jest serializowany w celu utworzenia obiektu stanu wyjątku, który zawiera serializowane dane dotyczące wyjątku.Occurs when an exception is serialized to create an exception state object that contains serialized data about the exception. (Odziedziczone po Exception) |