i am developing window application in c# and .net and i want to know that how to write a join query for update of local database by the content of remote server database!.
Scenario :- Suppose there is one database say softbuyweb at local machine and other database softbuyweb1 at remote server.
now there is table in softbuyweb say product and similarly there is table in softbuyweb1 say product1
now both the table product and product1 in database softbuyweb and softbuyweb1 respectively has same column/field name, datatype and length of datatype.
now i want that in my window form i place one button say "Update" on its click event there should be query which fires and the total content of table product1 at remote server is copied and the content of table product at local machine is updated with that copied content.
i think it is little confusing and also it may be difficult to write single sql query for two different data sorce connection and it might create ambiguity because both connection are establishes in a single block of code.
now , please help me on this topic , and please response as qick as possible!
my database is in sql server 2005.
thanx in advance.
Is the remote server truly remote, i.e. not on the same LAN? I have written software to do this, but it assumes only one database is being modified. In my case I have an eCommerce website where the transactions are processed and I have another server on a different network that connects to the eCommerce site every 30 minutes or so and downloads only the _new_ transaction information.
If this is the case then what I did was write a class, for your case "Products" and created public properties that corresponded to the databases and implemented XML Serialization in the class. I have a bit in the database "Transferred" and I create a List<Products> with all of the records, serialize the data, send it from an ASP.NET application to a C# windows application, which turns around and imports the data, and sends back a manifest of the unique identifiers that were imported.
That is one approach, another may be SQL Server Replication...