hello
you can also use SQLBULKCOPY for this with help of given code, but first u have to create both the tables i.e. source table and destination table
string connection = "Data Source=.;Initial Catalog=master;Integrated Security=True";
SqlConnection myconnect = new SqlConnection(connection);
myconnect.Open();
SqlCommand cmd = new SqlCommand("select * from sourcetable", myconnect);
SqlDataReader dr = cmd.ExecuteReader();
SqlConnection con = new SqlConnection(connection);
con.Open();
SqlBulkCopy bulk = new SqlBulkCopy(con);
bulk.DestinationTableName = "desti";
try
{
bulk.WriteToServer(dr);
}
catch (Exception ex)
{
MessageBox.Show("Some error");
}
finally
{
dr.Close();
}
myconnect.Close();
MessageBox.Show("Record Copied");
Do Rate my answer once you find it useful
Thanks & Regards
Radix :)