I have tableA in database1 and tableA in database2 both have similar number of columns and names basically same tables. But both have different data in them. I am trying to get a row from database1/tableA and insert it into database2/tableA.
This is how i am thinking of doing it:
SqlConnection conn = new SqlConnection("database1")
SqlCommand cmd = new SqlCommand("Select * from tableA where id = 1");
connection.Open()
SqlDataReader reader = cmd.ExecuteReader();
if(reader !=null )
var data = reader;
connection.Close();
Then i do the same above steps open a new connection and try to insert data variable values to tableA in database2.
Is this right approach? Is there a better way to do this?