Solved

Vb.net Update all modified records in a remote database

Posted on 2009-05-11
3
289 Views
Last Modified: 2012-05-06
I have a sql database in my pc and another located in a web server. I have the Charges table in both. I need to transfer from pc to online all records not payed. But i need to, mark in online database  all records payed from last update. Anyone have any sugestion.
0
Comment
Question by:rflorencio
  • 2
3 Comments
 
LVL 31

Expert Comment

by:RiteshShah
ID: 24353678
I am not clear 100% about your goal but you can do one thing. you can add your webserver as linked server with sp_addlinkedserver, suppose you give name "MyWebSrv" to your linked server than you can set INSERT and/or UPDATE trigger to update/insert records in your web server database.

like

create trigger trig
on yourtablename
as
begin

update websrv set websrv.record1=inserted.record1
from MyWebSrv.DatabaseName as websrv
JOin
Inserted
ON websrv.field1=inserted.field1


end
0
 
LVL 31

Expert Comment

by:RiteshShah
ID: 24353681
I missed one thing in trigger snippet.

create trigger trig
on yourtablename
for update
as
begin

update websrv set websrv.record1=inserted.record1
from MyWebSrv.DatabaseName as websrv
JOin
Inserted
ON websrv.field1=inserted.field1


end
0
 
LVL 57

Accepted Solution

by:
Raja Jegan R earned 500 total points
ID: 24353697
Logic below:

1. Add one more column to the existing table and have it as 'N' by default.
2. Move the records with 'N' value from pc to online and after that update its value to 'Y'.
3. Hence the new records will be in status 'N'.
4. Next time move only records with 'N' status and repeat steps 2 - 4.

Hope this helps.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now