Solved

Vb.net Update all modified records in a remote database

Posted on 2009-05-11
3
291 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

815 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

8 Experts available now in Live!

Get 1:1 Help Now