Unfortunately there is nothing simple in .net to do this, The best thing I have ever found for something like this is the lowly Jet Provider of all things... Take a look at the following
code (Would need to be modified a bit to work in .Net as this is VB6 code, but the idea is in the SQL Statement_ It opens a connection to an empty MDB file and then uses the
provider to do a dandy insert from one SQL Server to another (Using ODBC) You could substitute most any ODBC Complient database into this and make it work...
Dim cn As ADODB.Connection
Dim strSQL As String
Set cn = New ADODB.Connection
cn.CursorLocation = adUseClient
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\AnEmpty.mdb"
strSQL = "Insert INTO [ODBC;Driver={SQL Server};Database=Northwind;" _
& "Server=Server1;uid=sa;pwd=Password1;].[products](ProductName,SupplierID," _
& "CategoryID,QuantityPerUnit,UnitPrice,UnitsInStock,UnitsOnOrder,ReorderLevel," _
& "Discontinued) select ProductName,SupplierID" _
& ",CategoryID,QuantityPerUnit,UnitPrice,UnitsInStock,UnitsOnOrder" _
& ",ReorderLevel,Discontinued FROM [ODBC;Driver={SQL Server};Database=Northwind;" _
& "Server=Server2;uid=sa;pwd=Password;].[products]"
cn.Execute strSQL
Want to know more? Check out the MSDN Library at
http://msdn.microsoft.com or the Microsoft Knowledge Base at
http://support.microsoft.com
Scot Rose, MCSD
Microsoft Visual Basic Developer Support
Email : (e-mail address removed) <Remove word online. from address>
This posting is provided “AS IS”, with no warranties, and confers no rights.
--------------------