Insert Data From One Table To Another Using ADO.NET

Introduction 

In this Blog, we will see how we can insert data from one table to another table using ADO.NET. 

Given below code snippet will help you to understand how we will use Ado.net to back up the data into another table.

string SqlQueryBackUp = "Insert Into UsersBackUp(Name,Address,PhoneNo) Select Name,Address,PhoneNo From Users";
SqlCommand sqlCommand = new SqlCommand(SqlQueryBackUp, con);
try {
    con.Open();
    sqlCommand.ExecuteNonQuery();
    Console.WriteLine("Record Inserted Successfully");
} catch (Exception e) {
    Console.WriteLine("Error Details" + e.ToString());
} finally {
    con.Close();
    Console.ReadKey();
}

Program Output

How to insert the data from One Table to Another Table Using Ado.NET