Compare specific field from two different database table

If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
8 posts Page 1 of 1
Contributors
User avatar
KraZy
Top Poster
Top Poster
Posts: 93
Joined: Sat May 26, 2012 8:40 am

I'm actually developing a synchronization tool in vb.net, I have two database that have on each table records field GUID, this field help to have the same PK on both database. On each record there is also a field called lastUpdated, this field have a milliseconds value, so prevent two user to update the record in the same time. My question is, how I can compare the records of the same table from different db? For example:

ONLINE_DATABASE

TABLE_1
Code: Select all
| ID |   GUID                             | NAME  |    LASTUPDATED              |
| 5  | 054ba092-b476-47ed-810b-32868cc95fb| John  | 06-01-2016 17:01:12.472438  |
CLIENT_DATABASE

TABLE_1
Code: Select all
| ID |   GUID                             | NAME  |    LASTUPDATED              |
| 9  | 054ba092-b476-47ed-810b-32868cc95fb| Jack  | 06-01-2016 18:01:12.472438  |
How you can see I've update the record from client application, so I need to apply the same change to online database. Now I've a thousand records to check in about ten tables. So my question is, how I can made a system that do this? Actually I tough to read each row with a MySqlCommand reader but I also think that this procedure is slow... Suggest?

NOTICE THAT: the table have the same name in both db
I'm in the empire business.
User avatar
visualtech
VIP - Donator
VIP - Donator
Posts: 265
Joined: Sat Nov 19, 2011 2:19 pm

I'd suggest you use relational mappings for your tables. Then, you can setup by-pass connecters for the different databases you have, and voila! If you need help, you know where to find me! :D
Image
User avatar
KraZy
Top Poster
Top Poster
Posts: 93
Joined: Sat May 26, 2012 8:40 am

relational mapping? I don't know what is this, could you help me?
I'm in the empire business.
User avatar
visualtech
VIP - Donator
VIP - Donator
Posts: 265
Joined: Sat Nov 19, 2011 2:19 pm

Skype. @chris.harrison367
Image
User avatar
KraZy
Top Poster
Top Poster
Posts: 93
Joined: Sat May 26, 2012 8:40 am

Again, I doesn't have skype account more, you have another social like hangouts or other?
I'm in the empire business.
User avatar
visualtech
VIP - Donator
VIP - Donator
Posts: 265
Joined: Sat Nov 19, 2011 2:19 pm

Image
User avatar
KraZy
Top Poster
Top Poster
Posts: 93
Joined: Sat May 26, 2012 8:40 am

visualtech wrote:
labs.visual@gmail.com - Hangouts
I contacted you, hope that you can help.. I'm Ferven
I'm in the empire business.
User avatar
visualtech
VIP - Donator
VIP - Donator
Posts: 265
Joined: Sat Nov 19, 2011 2:19 pm

For what you've mentioned a simple query like the following should do; tweak it as you like:
Code: Select all

SELECT 
	CLIENT_DATABASE.TABLE_1.*,
	ONLINE_DATABASE.TABLE_1.*
FROM
   CLIENT_DATABASE.TABLE_1
       INNER JOIN ONLINE_DATABASE.TABLE_1
           ON CLIENT_DATABASE.TABLE_1.GUID = ONLINE_DATABASE.TABLE_1.GUID

Image
8 posts Page 1 of 1
Return to “Coding Help & Support”