7
Answers

How we sync data into our cloud server by using C#

Mohan Chandra

Mohan Chandra

8y
252
1
Hi, I am new on this, I need a solution actually,
report is coming from tally to excel and then excel to local SQL by Importing and then Local SQL to our Cloud server.

suppose we installed a software, so first time we will put all records till today from his local SQL to our cloud server.
now suppose client sync data on daily basis by enter date and it will work on our C# code.

Now my question is

1- suppose client make a entry on back date, client's supplier has receipt of back date and client forgot to enter it in invoice table,
so now how we can sync data from local SQL to Cloud Server without any comparison and overwrite in our cloud server.
because it will take more more time.

2- suppose client forgot when last date he had synced data on cloud server in that case also no comparison and no overwrite he wants.
how we can achieve it please give me just solution please.
 
 
please help me my boss give a question to think about it
Answers (7)
0
Mohan Chandra

Mohan Chandra

NA 93 7.3k 8y
please reply me,
If i give a linked server from Local SQL to our cloud server so it will sync automatically?
when it will sync automatically?
and it will sync only those records who are not in our cloud server but have in local SQL????
please reply me,
 
during create a job On step can we write a query like
 
select * from Invoices into.......(what we need to give)  where Status='Not Uploaded';
update Invoices set status='Uploaded' where Status='Not Uploaded';
 
please if you can share some screen shots..........or may be a mail on
kandpaljoshimanoj1988@gmail.com 
 
 
thanks for help me.
i need to give answer him before today leave the office?
0
Mohan Chandra

Mohan Chandra

NA 93 7.3k 8y
Ok I got your first answer little bit,
Now please help me you want to suppose we have INVOICE table in local SQL and in Cloud Server too.
Now you want to say we will give a Status column in Local SQL and by default it will be "Unuploaded" and when data sync with Cloud server means when a row uploaded in Cloud server status will be "Uploaded".
one more thing that when it will sync automatically? and when it will be uploaded in cloud server it will update the status automatically.please help me.
thanks for your support me.
0
Vishal Jadav

Vishal Jadav

NA 1.7k 57.9k 8y
Hi,
Please read my first answer i have described the flow there.
A status column will suffice to compare the data.
Based on that column value sync the data.
Don't put Sync button on client side,tell them it will be done automatically on a certain duration.
Please let me know if any doubt.
Thank you.
0
Mohan Chandra

Mohan Chandra

NA 93 7.3k 8y
but client side means in our software i need just a button"SYNC" and records should be updated in my cloud server,,,,,client dont know about that na,so then what should I do for that,,,,,,,should not comparison and overwrite in cloud server.
0
Vishal Jadav

Vishal Jadav

NA 1.7k 57.9k 8y
Hi,
Please follow below steps to create a linked server.
Below is the sql to create a linked server in your sql server.
--------------------------------------------------------------------------------------------------
USE [master]
GO
EXEC master.dbo.sp_addlinkedserver @server = N'SERVER IP', @srvproduct=N'SQL Server'
EXEC master.dbo.sp_addlinkedsrvlogin @rmtsrvname=N'SERVER IP',@useself=N'False',@locallogin=NULL,@rmtuser=N'SQL USER NAME',@rmtpassword='SQL USER PASSWORD'
GO
EXEC master.dbo.sp_serveroption @server=N'SERVER IP', @optname=N'collation compatible', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'SERVER IP', @optname=N'data access', @optvalue=N'true'
GO
EXEC master.dbo.sp_serveroption @server=N'SERVER IP', @optname=N'dist', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'SERVER IP', @optname=N'pub', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'SERVER IP', @optname=N'rpc', @optvalue=N'true'
GO
EXEC master.dbo.sp_serveroption @server=N'SERVER IP', @optname=N'rpc out', @optvalue=N'true'
GO
EXEC master.dbo.sp_serveroption @server=N'SERVER IP', @optname=N'sub', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'SERVER IP', @optname=N'connect timeout', @optvalue=N'0'
GO
EXEC master.dbo.sp_serveroption @server=N'SERVER IP', @optname=N'collation name', @optvalue=null
GO
EXEC master.dbo.sp_serveroption @server=N'SERVER IP', @optname=N'lazy schema validation', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'SERVER IP', @optname=N'query timeout', @optvalue=N'0'
GO
EXEC master.dbo.sp_serveroption @server=N'SERVER IP', @optname=N'use remote collation', @optvalue=N'true'
GO
EXEC master.dbo.sp_serveroption @server=N'SERVER IP', @optname=N'remote proc transaction promotion', @optvalue=N'true'
GO
--------------------------------------------------------------------------------------------------
Hope it helps.
Try it and let me know if any issue.
Thanks.
0
Mohan Chandra

Mohan Chandra

NA 93 7.3k 8y
can you share any screen shots for that please?actually i did not work yet like as 
0
Vishal Jadav

Vishal Jadav

NA 1.7k 57.9k 8y
Hi,
To sync data i prefer LINKED SERVER in sql server. Its just as a connection to a db in our server.
Add Status column in the tables which will then used to check whether record is inserted, updated or removed.
Create a job in SQL server which will run at a fixed interval let say 2 minutes or make it run from C# code when needed.
The job will check the data from the local table and if any entry is inserted , updated or removed same will be synced using LINKED SERVER object.
If you have any doubt please let me know.
I will help as much as i can.
Hope it helps.
Thank you.