Question Custom Sync Tool


New member
Nov 27, 2018
Programming Experience

How I can create one application that get results from one MS SQL Server query
compare them with one MYSQL Server query and if it is equal then do update else do insert.

For example, let say I have my source sql query
Select ID, FName, LName From TBNames
ID | FName | Lname
1 | John | Eaglin
2 | Harry | Baggerly
3 | Charlie | Abbett
4 | George | Dent

Then from Mysql query I have the result
Select ID, fName, LName from MYNames where ID = {MSSQL_ID};
ID | FName | Lname
1 | John | Smith
2 | Tomas | Ford

I need to pass through ID field and update ID 1 and 2 from Smith to Eaglin
from Tomas Ford to Harry Baggerly and insert the other 2 records.
Running the same select on MYSQL I get the result
ID | FName | Lname
1 | John | Eaglin <-- Last Name changed
2 | Harry | Baggerly <-- Both Names changed
3 | Charlie | Abbett <-- Inserted
4 | George | Dent <-- Inserted
The problem is that queries are many with lot of different fields and tables.
Is there any way I can pass fields names and results as variables to the update or insert query?

Thank you


VB.NET Forum Moderator
Staff member
Aug 17, 2004
Sydney, Australia
Programming Experience
You're talking about four separate operations and each one is simple; or simple to find information on, at least. If you want to use data from SQL Server then query SQL Server for the data you want. Simple. If you want to use data from MySQL then query MySQL for the data you want. Simple. If you want to compare data then compare data. Where it came from isn't relevant to that. Simple. If you want to update one of the databases then update one of the databases. Simple. Do the appropriate research on each of those four topics independently and learn how to do them independently. You can write code to do any one of the four with no concern for the others. If you encounter a specific issue on any one task, ask about that specifically. Once you can do all four, try putting them together and massaging the bits between them. If you encounter a specific issue doing that, ask about that specifically.

That's how software development works. It is very modular, so you don't try to go from 0 to 100 on a single, complex problem. You break the problem down into smaller parts and solve each of those problems independently, then combine to partial solutions into a single solution to the original problem. That's basically how problem solving works in any environment but certainly in software development.

One of the keys to your data access here will be use of a data adapters and DataTables, so keep that in mind when you're doing research. The data adapter allows you to retrieve and save data and the DataTable allows you to store and edit a copy of the data.