Connect 2 database in the same time in wpf - c#

I am trying to connect my app to 2 database (Sql Server) in the same time but these Sql Server stay in different place one is a local server and another one stay online and they are the same ,same Tables ,same fields and same data/records so i use LinqToSql to mapping them and i want connect my app to retrieve the data from the server online but when i want delete or add a new record it should do the same operation in both server ,i mean save data on both sql server,so i ask if you have any help about how work out this feature .
Thanks so much for your atttention.
have a nice time.
Cheers

I would suggest that you investigate database mirroring. I'm not sure how (or if) it works in a local - remote setup, but it would be the easiest solution as there is no code involved.
If that doesn't work or you aren't interested in looking at that option, my second suggestion would be to write a seperate service to monitor your local database (independant of your original application) for changes and push those to your remote server. Google SQL Server Change Tracking for more information on this method.

Related

MsSql server 2008 r2 Data Syncronization

I'm working on a project in C#.NET (WPF) with 2 SQL Server 2008 R2 databases. I need to update new/changed data from local db to online db. Client system has low bandwidth connection. So I need a solution to upload a file to sync.
Can anyone tell me how I can do this? Programming example will be more beneficial for me.
Learn about the following:
SQL Replication
Supports unidirectional or bidirectional synchronization
SSIS
Lets you define the mappings of the data, as well as transformations, and attach other code to the process easily
Linked-servers
Allows you to query databases and tables on remote servers as though they are part of the local database. Very easy to setup (just call exec sp_addlinkedserver) and once defined uses nothing but plain old SQL
Here is a simple tutorial about how to create a linked server.
After creating linked server, we can query it as follows:
select * from [LinkedServerName].[DatabaseName].[schema].[TableName]
If you need this to occur on a button-click or so, then I'd suggest you use linked servers within a stored procedure--they're the simplest option. SSIS would also be suitable, you'd need to execute the package on the button-click.

MySQL and Windows Store C# application

I've been searching about this on Google and I did find some useful stuff but I'm not totally sure if that's what I need so I'll ask here.
I'm trying to make a Windows Store application and I want to connect to a simple MySQL database that's on the server. What's the easiest or best way to do that? Whenever I need local databases I use Entity Framework. Is it possible to use it here and if so, are there any tutorials that cover everything that I need to install as well as some code examples?
My advice for you : read more about Database Engine :) cause once you connect you DB Engine to a Database : either it is local or on remote machine (Server) its the same thing when you look at it from your application.
1- First watch this read more about this : SQL Server Management Studio
2- watch this (how you connect to a remote database) enter link description here
3- Very important is to allow connection from Remote Machine enter link description here
4- Once you are able to connect to the remote database from your SQL Server, everythg is the same on EF.

What is the best way to port the data back and forth from our client’s local database to/from our webserver database?

My question is: What is the best way to port the data back and forth from our client’s local database to/from our webserver database?
An explanation of the problem:
Our clients run our software against their local copy of our SQL Server 2008 R2 database. We routinely (once a day, middle of the night) need to combine fields stored in multiple tables for each of these clients (i.e. a view) and send that information over the internet to a SQL Server 2008 R2 database which we will host on our webserver. Each of our clients may have tens-of-thousands of records which we will need to port to our webserver database.
This information will allow our client’s customers to make payments and place orders. We will store these transactions in one or more tables in our webserver database. At regular intervals we need to push these transaction records back to our client’s local database. The client will then process these transactions and update the records which we push up to our webserver database at night.
I am a C# programmer in a very small shop. My first thought was to write a windows service to control the porting of data back and forth. This would require installing the service on each of our client’s server. I am concerned with our ability to easily maintain and extend that service. In particular, when we decide to port more data back and forth this would require updating the service at each client site. Given the size of our shop, that would become a serious challenge.
I would prefer to manage this process through SQL Server, preferably at the SQL server instance on our webserver. However, we have no one with extensive knowledge of SQL Server. (I am the SQL Server guru here, and I know just enough to be dangerous.) Some of our clients are very small companies and only have SQL Server express installed on their server. We did some experiments with replication, but never found a way to make it wok reliably over the internet, especially with SQL Server express.
I have read some about SSIS, Linked Servers, Service Broker, and 3rd party tools such as RedGate’s SQL Compare. I am uncertain which, if any, of these options would best suit our needs and have not found clear examples showing how to make use of each.
Any guidance on this issue would be very much appreciated. It would be particularly helpful if you can point me to relevant examples showing how to do what I have described above.
Just fast,
one option is to use the MS Sync Framework - it does as I can see exactly what you need, though not sure of the specifics in your case.
hope this helps

iPhone Synchronizing SQLite with Windows Server Database

Background information:
I have been building an App that allows users to interact with each other, post comments/images for the App etc and these all information gets displayed on my App's FanWall screen. I am getting users information using their FaceBook authentication through FBConnect.
To update fanwall screen efficiently, I want to have a local SQLite database for my App that contains userId, his profile image, his comments for my App etc. I have all these info in my SQL server database but not sure how to synchronize this info with iPhone's SQLite database.
My problems:
I am using ASIHTTPRequest to query my SQL database and it can return whole table as Array of C# .NET class. The things that I couldn't understand is;
how to parse this C# .NET class using Objective-c to fetch each class object that is corresponds to each row.
I can then update my local SQLite using this object information but what could be best way to update only rows that are changed? Ideally I should be able to get only required rows from SQL server Database so that I just need to insert them in SQLite. I saw this post but not much helpful for my problem. Just wondering if there is any tool out there that can do this synchronization? I can have tables exactly same on SQL Server and SQLite.
Please let me know your thought on this.
Thanks.
I'm working on a similar problem. How to keep in sync a remote database with a local database. Either end could add or update rows. The solution seems to be to keep a column in each table called lastModifiedDate. This column is set on the server so there will be uniform time.
Periodically, connect to the server and request all rows greater than your local lastModifedDate to get updates and adds. Also, when you push your local changes to the server, the server should modify the lastModifiedDate for uniformity.
I haven't seen a framework for something like this.

Silverlight 4 OOB with local data options

Right now I have a Winform app with a SQL Server back end. The DAL is comprised of Linq to SQL. One of the complexities of this app is it's need to function offline.
I have accomplished this by using Merge Replication to keep there local SQL Express instances in sync with a central SQL Server. I have some logic that detects there connection state and switches the contexts connection string appropriately.
My question is thus, will this also work with Silverlight 4? In theory, I would detect when they are offline and switch the connection appropriately. Thoughts?
EDIT
It seems this is, in fact, possible. See HERE.
What I NOW would like to understand is if I could make EF or L2S work with this instead of RecordSets like it shows.
With Silverlight (any version) the problem isn't so much connectivity to the database. In Silverlight, you don't have it. The only thing you can do is make a call back to the server that the request originated from.
Because of this, you would have to have some sort of local IIS instance running and connect to that, which would then in turn connect to the local SQL instance.
The thing is, if your SL application was loaded from your site, and then connectivity was lost, your app couldn't detect it. You would have to go to a new link to the server on the local machine and then have them switch back when they have connectivity again.
For something like this, it's probably best that you stick with the Winforms app and determine whether or not you have connectivity there. That way, you can switch which database you hit when you don't have connectivity.
What casperOne is saying is that out of browser Silverlight does not have access to a full fledged database on the client. The best that can be done is to use some sort of compact database either in the isolated storage or within one of the few accessible folders with Silverlight 4. I have personally used siaqodb.com , but you will have to keep the data synchronized manually (which can be a nightmare).
More recently I have seen someone get access to a SQL compact database. However, there could be more ways of accessing data now. It has been some time since I've looked for a client side database for Silverlight.

Categories