Not enough information to go on but here are two examples.
I am assuming you're using SQL Server.
Threading:
using System.Data.SqlClient;
using System.Threading;
class Program
{
static void Main(string[] args)
{
string[] tables = args; // Get table names from command line arguments
string connectionString = "your_connection_string";
using (SqlConnection connection = new SqlConnection(connectionString))
{
connection.Open();
foreach (string table in tables)
{
Thread thread = new Thread(() => PurgeDataFromTable(connection, table));
thread.Start();
}
}
}
static void PurgeDataFromTable(SqlConnection connection, string tableName)
{
using (SqlCommand command = new SqlCommand("your_stored_procedure_name_here", connection))
{
command.CommandType = System.Data.CommandType.StoredProcedure;
command.Parameters.AddWithValue("@tableName", tableName);
command.ExecuteNonQuery();
}
}
}
Sequentially:
using System.Data.SqlClient;
class Program
{
static void Main(string[] args)
{
string[] tables = args; // Get table names from command line arguments
string connectionString = "your_connection_string";
using (SqlConnection connection = new SqlConnection(connectionString))
{
connection.Open();
foreach (string table in tables)
{
PurgeDataFromTable(connection, table);
}
}
}
static void PurgeDataFromTable(SqlConnection connection, string tableName)
{
using (SqlCommand command = new SqlCommand("your_stored_procedure_name", connection))
{
command.CommandType = System.Data.CommandType.StoredProcedure;
command.Parameters.AddWithValue("@tableName", tableName);
command.ExecuteNonQuery();
}
}
}
Also take a look here: Asynchronous in C#
Edit: added comments in code.