Solved

Vb.net Update all modified records in a remote database

Posted on 2009-05-11
3
293 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Question has a verified solution.

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

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

688 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