Results 1 to 2 of 2

Thread: Copy row from one database to another...

  1. #1
    Addicted Member
    Join Date
    May 06
    Posts
    158

    Copy row from one database to another...

    I have a MS SQL 2005 database on one server and then a copy of that database structure on a azure server. I want to copy a specific row of data from a table from server 1 to the same table on the azure server.

    The problem I have is that I do not know where to start, I am able to connect to both databases from my application. I would really like some advise on the best way to do this?

    Thanks

    Simon

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 05
    Location
    Sydney, Australia
    Posts
    80,773

    Re: Copy row from one database to another...

    I think that you're trying to complicate something that is very simple. Do you know know how to query a database? Do you know how to insert into a database? If you answered yes and yes then you know how to do this, because that's all it is. Think of the two operations as separate black boxes. You simply connect the output pipe of one to the input pipe of the other.

    If you actually don't know how to do those two things then I suggest that you follow the CodeBank link in my signature and check out my thread on Retrieving & Saving Data. If you go the ExecuteReader and ExecuteNonQuery route, which is fine for a single row, then you're good to go. If you go the data adapter and DataTable route, which is fine for one row and the only good option for multiple rows, then just make sure that you set the AcceptChangesDuringFill property of the first data adapter to False. That way, the DataRows will all have a RowState of Added and be ready for insertion.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •