DataSet.Clear Método
Importante
Parte de la información hace referencia a la versión preliminar del producto, que puede haberse modificado sustancialmente antes de lanzar la versión definitiva. Microsoft no otorga ninguna garantía, explícita o implícita, con respecto a la información proporcionada aquí.
Borra cualquier dato de DataSet mediante el procedimiento de quitar todas las filas de todas las tablas.
public:
void Clear();
public void Clear ();
member this.Clear : unit -> unit
Public Sub Clear ()
En el ejemplo siguiente se borran DataSet todas las filas de todas las tablas.
private void ClearDataSet(DataSet dataSet)
{
// To test, print the number rows in each table.
foreach(DataTable table in dataSet.Tables)
{
Console.WriteLine(table.TableName + "Rows.Count = "
+ table.Rows.Count.ToString());
}
// Clear all rows of each table.
dataSet.Clear();
// Print the number of rows again.
foreach(DataTable table in dataSet.Tables)
{
Console.WriteLine(table.TableName + "Rows.Count = "
+ table.Rows.Count.ToString());
}
}
Private Sub ClearDataSet(ByVal dataSet As DataSet)
' To test, print the number rows in each table.
Dim table As DataTable
For Each table In dataSet.Tables
Console.WriteLine(table.TableName & "Rows.Count = " _
& table.Rows.Count.ToString())
Next
' Clear all rows of each table.
dataSet.Clear()
' Print the number of rows again.
For Each table In dataSet.Tables
Console.WriteLine(table.TableName & "Rows.Count = " _
& table.Rows.Count.ToString())
Next
End Sub
DataSet Si está enlazado a , XmlDataDocumental llamar DataSet.Clear a o DataTable.Clear genera .NotSupportedException Para evitar esta situación, recorra cada tabla, quitando cada fila una cada vez.
Producto | Versiones |
---|---|
.NET | Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |
Comentarios de .NET
.NET es un proyecto de código abierto. Seleccione un vínculo para proporcionar comentarios: