copy rows between sql server databases programatically with .NET
I have a website that runs in one server and is used to preview some content. Once the user is happy with it, it needs to be approved and published to the live server. This only implicates copying data from a few tables...
What'开发者_开发百科s the best way of approaching this?
EDIT: I'm using ASP.NET 4, MVC2, SQL Server 2005 on the local server, and SQL Server 2000 in the live one.
Thanks
You could use SQL Link Server between SQL 2005 and SQL 2000, in which you can then write a query on the SQL 2005 Instance to transfer the Data to the SQL 2000 instance.
Also you could use ASP.NET ADO Connections and Make a Seperate connection to either server, and use a DataSet to transfer your data through you .NET code between 2 x SQL Functions.
If you are inserting Data into either Database using ADO SQLCommand object, make sure to use Parameters Querys rather than building your query with & or + signs.
精彩评论