Skip to content

ClearTable

Darren Comeau edited this page Oct 14, 2018 · 3 revisions

ClearTable(String, String)

Remove all rows of data from the table.

Overloads

public int ClearTable(string schemaName, string tableName);

ClearTable(string schemaName, string tableName)

Parameters

schemaName String

The database schema which hosts the object.

tableName String

The name of the database table which we should delete data from.

Examples

Delete all the data held in a table.

// Setup the Database Tester object using the MS SQL implementation
var connectionstring = @"Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=tempdb;Integrated Security=SSPI;";
VulcanAnalytics.DBTester.DatabaseTester tester = new VulcanAnalytics.DBTester.MsSqlDatabaseTester(connectionstring);

// Parameters for ClearTable method
var schemaName = "dbo";
var tableName = "TestPerson";

// Call the ClearTable method to delete all rows
tester.ClearTable(schemaName, tableName);

Remarks

Intended for use with tables only.