Este artículo se tradujo de forma manual. Mueva el puntero sobre las frases del artículo para ver el texto original.
Traducción
Original
Este tema aún no ha recibido ninguna valoración - Valorar este tema

DataRow.EndEdit (Método)

Finaliza la edición que se está produciendo en la fila.

Espacio de nombres:  System.Data
Ensamblado:  System.Data (en System.Data.dll)
public void EndEdit()
Excepción Condición
InRowChangingEventException

Se ha llamado al método dentro del evento RowChanging.

ConstraintException

Restricción interrumpida por la edición.

ReadOnlyException

La fila pertenece a la tabla y la edición ha intentado cambiar el valor de una columna de sólo lectura.

NoNullAllowedException

La edición ha intentado colocar un valor nulo en una columna donde AllowDBNull es false.

Cuando se establece esta propiedad, se genera una excepción si en el evento RowChanging se produce una excepción.

En el ejemplo siguiente se utiliza el método EndEdit para finalizar la edición de un valor DataRow si la función de validación devuelve true.


private void AcceptOrReject(DataRow row)
{
    // Use a function to validate the row's values.
    // If the function returns true, end the edit;
    // otherwise cancel it.
    if(ValidateRow(row))
        row.EndEdit();
    else
        row.CancelEdit();
}

private bool ValidateRow(DataRow thisRow)
{
    bool isValid = true; 
    // Insert code to validate the row values. 
    // Set the isValid variable.
    return isValid;
}


.NET Framework

Compatible con: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Compatible con: 4, 3.5 SP1

Windows 7, Windows Vista SP1 o posterior, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (no se admite Server Core), Windows Server 2008 R2 (se admite Server Core con SP1 o posterior), Windows Server 2003 SP2

.NET Framework no admite todas las versiones de todas las plataformas. Para obtener una lista de las versiones compatibles, vea Requisitos de sistema de .NET Framework.
¿Le ha resultado útil?
(Caracteres restantes: 1500)
Contenido de la comunidad Agregar